Depositing counterfeit money into a bank account is illegal, even if you do not know it is illegal. However, a court would have to prove intent to defraud the bank. Money passes hands every day, so unless you knew the money was counterfeit, you probably would not go to jail. However, if you try to deposit money and the bank finds it is fake, you will lose the value of the bills.
Once you know bills are counterfeit you become a criminal if you try to pass them. Intentionally passing counterfeit bills carries a sentence of no more than 15 years in jail and fines up to $5,000 (as of May 2011). If you manufacture counterfeit money, you can go to jail for up to 15 years, but the fines are much greater, sometimes in the hundreds of thousands or millions of dollars.
If you have counterfeit money in your possession, it is best to turn it in to the local police or Secret Service rather than try to pass the "loss" onto another party and risk breaking counterfeiting laws. You will probably have to accept the loss of the money, even when you get the counterfeit currency from a bank. Once you leave a bank, the bank cannot take responsibility for counterfeits -- there is no other way of tracking the money.
When you come into possess of counterfeit money, take every measure possible to prevent the crime being pinned on you. Do not handle the counterfeit bill too much in case the Secret Service needs to take fingerprints. Write down a description of the party that gave you the counterfeit money, when and where the transaction took place. Put your initials on the bill for identification of the note later.