Police in Maine are investigating after a malfunctioning ATM at a bank spit out $37,000 in cash to a man who requested $140.

South Portland police tell WGME-TV that they responded to the TD Bank branch at about 5:30 a.m. Thursday after getting a call from a woman who said a man was spending an unusual amount of time at the ATM she was waiting to use.

Responding officers found the man stuffing cash into a shopping bag.

The money was returned to the bank, and bank officials said they don't want to press charges. But police continue to investigate. The identity of the man wasn't released because he hasn't been charged.

A bank official described the problem as a "code error'' and said no customer accounts were affected.