It's perfectly legal to make a $10k cash deposit into or withdrawal from your bank (assuming that the underlying use/source of the cash is legal, of course). It is, however, definitely ILLEGAL to make a $9999 deposit for the purpose of staying below that $10k limit. It's called structuring, and can get you into a lot of trouble.
As an example, you sell a car for $13,000, and get paid in cash. If you go and deposit that $13k in cash in the bank, you're entirely kosher. It'll generate a currency transaction report, but they're not at all uncommon.
If, however, you deposit $9k, and then $4k, to stay below that $10k ceiling, you've just committed a federal crime. https://en.wikipedia.org/wiki/...