A landmark ruling against two leading drug companies could save the NHS in England "hundreds of millions" a year.
Novartis and Bayer were trying to stop NHS doctors from prescribing a cheaper treatment for a serious eye condition.
Health bosses said the judgement in the High Court may reduce the power of companies to set prices.
Drug company Novartis said they were "disappointed" because patients were being asked to accept an unlicensed treatment to save the NHS money.
The case centred on the treatment of patients with the common eye condition, wet age-related macular degeneration (AMD).
Twelve NHS bodies in the north east of England were offering these patients Avastin, a cheaper alternative to the licensed drug, Lucentis.
David Hambleton, chief executive officer of NHS South Tyneside clinical commissioning group (CCG), one of the NHS groups involved in the case, welcomed the judgment, saying it was a good day for patients and the NHS.
"We've always said we think that it's important that patients should have the choice of a very effective treatment for wet AMD, and it's actually a fraction of the cost of the other alternatives.
"So I think what we do now is offer patients that choice. We believe that they will support very strongly having a cost-effective, safe treatment and saving the NHS generally a lot of money. It is a victory for common sense over commercial interests."
What was the dispute?
The case was brought by pharmaceutical giants Bayer and Novartis against twelve NHS CCGs in the north of England.
The NHS groups were offering patients a choice between Lucentis and Eylea - drugs licensed for eye treatment - and the far cheaper drug Avastin, which is recommended by the World Health Organisation (WHO) for treating eyes, but only licensed for cancer treatment in the UK.
Novartis and Bayer manufacture the two more expensive licensed drugs - Lucentis which costs £561 and Eylea which costs £800.
By comparison, Avastin costs about £28 per injection.
Avastin is widely used around the world, particularly in the US.
In January, the National Institute for Health and Care Excellence (NICE) concluded that Avastin was as safe and effective as the two licensed drugs, Lucentis and Eylea.
What was the reaction?
Mike Burdon, President of the Royal College of Ophthalmologists said: "Licensing laws are designed to protect patients from poorly regulated unproven drugs, but it is the drug companies' responsibility to apply for a licence.
"We are treating 40,000 new diagnoses of wet AMD annually - the saving could amount to £500m a year. This amounts to one district hospital being built annually."
What is AMD?
- Age-related macular degeneration (AMD) is an eye condition that affects more than 600,000 people, 40,000 of those suffer from wet AMD
- It causes people to lose central vision, usually in both eyes
- It is more common with age and there are two main types - wet AMD and dry AMD
- Reading becomes more difficult, colours appear less vibrant and faces can be hard to recognise
- Wet AMD develops when abnormal blood vessels form and damage the cells at the back of the eye
- Wet AMD can be treated if caught early. Drugs are injected into the eye to stop the growth of the abnormal blood vessels
David Hambleton, of NHS South Tyneside CCG, said the ruling would result in a rethink for NICE and the MHRA, the UK's drug regulatory body.
"I think at least we've got some real legal clarity now, so both of the bodies - NICE and the MHRA - will need need to look at what their guidance says.
"Now they have the option of allowing the use of so-called 'off-label' drugs."
Responding to the ruling, a spokesperson from pharmaceutical company Novartis said: "Novartis is deeply disappointed in this decision and remains of the opinion that the policy undermines the well-established legal and regulatory framework that is there to protect both patients' safety and to ensure health care professionals can prescribe with confidence."
Dr Sheuli Porkess, Deputy Chief Scientific Advisor to The Association of the British Pharmaceutical Industry (ABPI) said:
"This extraordinary judgement potentially undermines the regulation of all medicines and by doing that, neither patients nor doctors have clarity on what information to trust."