Pedestrians walk past a Citizens Bank location in downtown Boston, Mass. (Kelvin Ma/Bloomberg)

Citizens Bank failed to give customers their full deposits at times when the size of the deposit didn’t match the number written on deposit slips, regulators said Wednesday.

The bank will need to pay a penalty of at least $34.5 million because of those “deceptive practices,” according to the joint enforcement action by the Consumer Financial Protection Bureau, the Federal Deposit Insurance Corporation and the Office of the Comptroller of the Currency.

Instead of giving workers the difference when there was a mismatch in the paperwork, the bank at times pocketed the cash, officials said. The discrepancies, which arose between 2008 and 2013, came up when the bank’s scanners misread the number on deposit slips or when customers jotted down the wrong amount, officials said.

Citizens told customers that discrepancies would be investigated and corrected, but it only did so for deposit amounts above $50, and later above $25. Over time, the money pocketed by the bank added up to millions of dollars.

“This is sloppy banking,” said CFPB director Richard Cordray. “Many consumers lost money that rightfully belonged to them.”

In addition to $20.5 million in federal penalties, Citizens will need to pay $11 million to consumers and $3 million to businesses that didn’t receive their full deposits, officials said. Customers should get not only the difference in the deposit amounts, but interest and a refund of any fees they may have faced as a result of the shortfall, including overdraft fees, insufficient fund fees and maintenance fees.

Officials said the error may have led some customers to receive more money than they actually deposited, but that those cases were not part of the enforcement action.  In a statement, Citizens said the amounts overpaid to customers and underpaid to others “were approximately equal.”

The CFPB looped in other regulators after getting a tip from a whistle blower about the practice, officials said. Citizens Bank said the reconciliation process was automated at the end of 2013 after the bank rolled out a new teller system. “We are now working with our regulators to make appropriate redress as quickly as possible,” the statement said.

Customers owed refunds don’t have to do anything to receive their refunds, regulators said, adding that the bank has already taken steps to improve its practices.

Read more:

Why Citibank may owe you money

It might be time to ditch the checking account you opened in high school

How to find a checking account that pays you to use it

A guide to breaking up with your bank