NHS regulator Monitor "misdirected itself in law" when applying the statutory cap on what health service foundation trusts can earn from private patient work, the High Court ruled today.
Monitor said it accepted the court's decision, welcomed the court's clarification and "will now amend its approach accordingly".
Unison, which had challenged the regulator, declared the ruling "a victory for NHS patients".
The UK's largest public sector union accused Monitor of "undermining" the provision of NHS services by failing to produce accurate guidelines on what trust hospitals need to declare relating to income derived from private patient services.
Today Mr Justice Cranston, sitting in London, ruled that Monitor's application of the statutory cap was wrong in law as it "did not reflect the intention of Parliament, as expressed in the legislation".
The judge determined that the cap should apply to a wider range of income sources.
Later, Unison general secretary Dave Prentis said: "Today's decision is a victory for NHS patients.
"The Bill introducing foundation trusts allowed them to treat private patients, but included a safety net of a cash limit.
"That limit was designed to ensure that private patients could not buy their way to the front of the queue at the expense of NHS patients."
Mr Prentis said it was clear that Monitor's failure to produce accurate guidelines had allowed trusts "to look for loopholes to enable them to treat more private and fewer NHS patients.
"This was clearly against the founding principles of the NHS that treatment is based on need, not ability to pay."
Unison asked the judge for guidance on the correct interpretation of Section 44 of the National Health Service Act 2006 and how the cap should be applied.
Monitor's executive chairman, William Moyes, said Monitor's intention had always been "to apply the cap in a way that is fair and reasonable".
He said after today's ruling: "This is a complicated issue, as was demonstrated by the various arguments in court, and the divergence of views we received when we consulted on our interpretation of the cap.
"We accept the outcome of this judicial review and will now focus on amending the regulatory framework in line with the ruling of the court.
"It will be important that, taking appropriate advice and working co-operatively, we produce a framework that is compliant with the judgment today and is also as far as possible practical and workable in its application.
"We are also hopeful that the Government's review of this piece of legislation will address any remaining concerns or doubts that may exist regarding the application of the cap."
In a recent hearing which led to today's ruling, Peter Oldham, appearing for Unison, accused Monitor of making "unprincipled and arbitrary distinctions" between income that counted as private patient income and income that did not.
Under the 2006 Act, trusts were authorised on the basis that their principal purpose was the provision of goods and services for the NHS, said Mr Oldham.
Monitor was required to restrict "income derived from" private services in any financial year and ensure it remained at or below a statutory base level.
But the regulator's financial reporting instructions stated that private patient income referred only to charges made "directly to patients".
Mr Oldham said that wrongly excluded income derived from the provision of goods and services to private healthcare providers who raised their own private charges.
Also excluded was income paid to trusts by charities funded from providing services to private patients, and investment income from the provision of private healthcare.
Mr Oldham said the law should be interpreted in a way that prevented trusts adopting "artificial structures for circumventing the cap".
The terms "subsidiaries", "joint ventures" and "associates" were being used in such a restricted way under the current Monitor instructions that income derived from them was not being counted as private income.
Agreeing that Monitor had gone wrong in law, the judge said the regulator would now have to reconsider what capping option accorded with the correct meaning of the statutory concept "income derived from".
Although Unison won its case, the judge did not accept the union's argument that trust accounts for earlier years should now be unravelled and recalculated.
The judge said: "Although there was no evidence before the court one way or the other, it seems sensible to assume that the accounts for most NHS foundation trusts for 2008/09 and earlier years are closed and near completion and that it would be unduly disruptive, and a waste of public resources, to unravel them and have them recalculated."
The judge also acknowledged that Monitor's approach had been operating for several years, during which time it had been open to public consultation, before it was challenged by Unison in 2007.
He observed that the Department of Health's position was that some reform to the cap was desirable.
If aspects of his judgment caused practical difficulties, they could be addressed in the Government's current review.
Trust organisations said today's ruling showed there was now an urgent need for reform.
The cap was not about treating private patients but enabling trusts to develop "new commercial strategies" which would ultimately benefit NHS patients.
They pointed to the fact that the Government had already recognised the need for change by initiating a review of the cap, and granting mental health foundation trusts a cap of 1.5% to enable them to develop new services.
Sue Slipman, director of the Foundation Trust Network, said: "The private patient income cap is not about treating private patients.
"It is about enabling foundation trusts to develop new commercial strategies that will bring additional resources into the NHS to benefit NHS patients.
"The original legislation was framed to stop foundation trusts fundamentally changing their nature as NHS organisations, and we support that principle.
"Today's judgment underlines the need for the law to change.
"The Government review is an opportunity for fresh thinking and to bring coherence to a policy that will ultimately benefit NHS patients and the cash-strapped health service."