A major bank has apologised to thousands of its customers who were impacted by an error that led to them being massively overcharged.