A hospital has lost £2.5m in funding for treating patients too quickly.
Ipswich Hospital is already facing huge debts
Ipswich Hospital, in Suffolk, which is more than £16m in the red, accidentally breached an agreement to ensure all patients had similar waiting times.
Ipswich Hospital agreed with the East Suffolk Primary Care Trusts, which fund treatment, that patients should wait at least four months for treatment.
However, doctors had treated patients inside that time and the trust refused to pay the £2.5m cost of treatment.
This will now have to come from the hospital's own budget, adding to its financial difficulties.
An Ipswich Hospital spokeswoman described the incident as a "local glitch".
The government has said patients should wait no longer than six months before treatment.
The trusts agreed that patients should wait at least four months.
The hospital spokeswoman said it was thought the agreement would be the best way to ensure that no-one jumped queues and that everyone was waiting a similar length of time.
During the past two years, hospital doctors had breached the agreement as they treated a number of patients inside four months, and the trusts refused to pay.
The hospital spokeswoman said: "In a number of cases we had breached the agreement - for understandable reasons, because we had spare capacity - and treated patients too quickly.
"The trusts refused to pay, as they were entitled to."
A Department of Health spokesman said: "All areas, including Suffolk and Ipswich, have had massive increases in NHS funding. This has allowed the NHS to bring waiting times down from over 18 months to the current maximum of six months.
"Nationally the average wait for non-urgent inpatient treatment is around eight weeks. Ipswich Hospital NHS Trust is meeting our current target for inpatient treatment within a maximum of six months."
Liberal Democrat Shadow Health Secretary, Steve Webb MP said the case was a result of "crazy accounting rules".
He said: "It is a complete nonsense for one part of the NHS to be penalising another for treating patients too quickly.
"The government is paying over the odds to buy in capacity from the private sector, yet crazy accounting rules mean that spare capacity in the NHS itself cannot be used."