It's legal to enter a country with cash within the limits of what it states on the Customs form, without saying anything about it, and if it's found on you the Customs agents cannot detain you (legally, anyway - be wary regardless). If you have more than the stated amount e.g. $10k USD then you must declare it, else if you are searched and it is found you will definitely be detained.
My point is, what's the purpose of declaring, if it is illegal to enter the country (or leave the country) with more than $10,000 - does declaring it make it legal?