The money is not subject to tax because it was deposited. You can deposit money as much as you like, that's not what is triggering the tax.
What is triggering the tax is the sale itself, and it has already happened. If your friend is taxed for capital gains under the Spanish tax law - then this money is already taxable, and not paying the tax due is tax evasion.
Depositing the money may indeed trigger an investigation that will lead to evasion charges, but it would not be the depositing the money that was against the law.
Not depositing the money doesn't mean you will avoid investigation, it just means that the authorities may learn about it in a different way and charge you with additional crimes while at it (money laundering, fraud, whatever). Keeping large amounts of cash brings additional complications and dangers. The more people knowing about it (and they will, as you spend it), the higher chances are for you to "split" it with some robber or thief.
I suggest talking to a licensed tax accountant in Spain about whether the sale of the flat is taxable in Spain or not. If it is - pay the taxes due and be done with that.