I've had this happen to me, and a few years ago I happened to work for a short time with someone who had formerly been the president of a small regional bank. He confirmed that some banks do intentionally do that, and that many of the banking software systems had configuration options to decide what order to process data (debits or credits first) and that banks looking to make more money could just flip that switch and start raking in more fees.
It's really annoying to have people say that it doesn't happen when a) I've had it happen to me and b) I've had it confirmed by a banking executive.
Opening Balance: 100
Withdraw 50 --> 50
Deposit 200 --> 250
Withdraw 150 --> 100
At no time were they overdrawn. Evil Bank® would have done as you suggested, with the reconciliation at the end of the day being the old paper-based approach of: Opening Balance: 100
Subtract sum of Withdrawals: 200 --> -100
Subtract penalties: 50 --> -150
Add sum of Deposits: 200 --> 50I'm no longer a KeyBank customer (in between that and them cancelling my card for a $1 Roku pre-auth charge as 'suspicious' - but not notifying me, calling, etc, just popping a letter in the mail which arrived three days after I discovered for myself it was cancelled), unsurprisingly, as they refused to budge on waiving the fees (except for one - "you get one courtesy fee waiver per calendar year". The mind boggles).
I believe this resulted in class action law suits, and regulations preventing this behavior, but I can't find any news article about it at the moment.
Worth noting that is not the case in countries != America, and is in fact illegal in many countries.
Simply put if you make a mistake you don't correct it with tipex but with another entry to adjust the mistake. This means all mistakes are accounted for and balanced back to normality.
Also worth noting that banks love to process debits before they process credits so you could have 100 units of money in yoru account with another 200 going in and 200 going out. You will then see that on your statment that they have the 100 then the -200 and then the +200, so indicating that you are -100 for a period, evil are they not.