It added it has “since made significant changes to prevent it from happening again”.
The pre-payment customers, who are “often vulnerable”, were not made aware they were in credit when they cancelled their contracts, Ofgem said.
The credit amounted to £4.7m in total, but E.On is required to pay £6.6m compensation and has voluntarily agreed to pay £3.2m.
Ofgem said the £14.5m total payment is “in recognition of the impact on its customers, many of which may have faced financial difficulty”.
In cases where the customer cannot be identified, Ofgem said E.On will pay into the Energy Industry Voluntary Redress Scheme – a charity which supports vulnerable energy customers.
E.On has also agreed to write-off debt held by almost 150,000 prepayment customers who cancelled their accounts over the same period.
Ofgem said that it is progressing claims “against other suppliers on the same issue”.