When a bank makes a mistake and credits money to your account when it shouldn't, serious problems can arise. In rare cases the account owner may be able to keep the money. But, typically, the bank figures out the mistake and eventually demands the money back.
Regulations and Source
As pointed out by Liz Pulliam Weston of MSN Money, what happens after a bank credits your account by mistake depends in part on where the money came from and the regulations in place for funds from those sources. For example, if the bank deposits money from your employer it shouldn't have, the law allows the employer to take it right back out of your account without notice. In these cases, you might not even realize the mistake happened until you look at the transactions for your account in detail on your statement.
The Norm -- You Pay It Back
In most cases, you cannot keep money the bank credits to you by mistake.The bank can make a case for theft if you don't return the funds in full, even if it was the bank's fault you were credited in the first place. Subsequently, in the worst case scenario, not paying back the credit amount can get you jail time. It can take some time for the bank to figure out what happened, however.
The Exception -- You Keep It
In some rare cases, banks and other organizations involved in the account credit mistake insist that your account is fine. To be safe, it's best to get something in writing to this effect and to note the discrepancy you believe exists. If the institutions continue to state that everything is in order, you may be able to keep the funds. Ethically, even if this happens, it is still is your responsibility to make a good-faith effort to find out who really owns the funds.
Statute of Limitations
A federal law called the Electronic Funds Transfer Act allows you to protest bad electronic transactions. The law gives you 60 days from the date of the statement containing the error to do this. This offers you some protection in that it forces your bank to investigate the problematic credit. However, this doesn't stop the bank from taking back the money. Banks can have years to do this, depending on the statute of limitations in effect in your state.
The best thing to do if you receive a bank credit in your favor is to alert the bank right away. Explain in writing why you believe the credit is a mistake. Ideally, move the amount you believe was in error to a separate, new account. This way, you won't risk mingling the funds you shouldn't have with the money that is really yours and can quickly pay back the bank from the new account. Once the money is in the new account, leave it alone so the bank can investigate. In general, bank errors in your favor usually end up being a problem, not a benefit.