The Competition and Markets Authority (CMA) said drug maker Pfizer and distributor Flynn Pharma broke competition law when they increased the cost of a medicine used by around 48,000 patients in the UK.
The watchdog said their moves saw the cost to the NHS of phenytoin sodium capsules rocket from around £2m a year in 2012 to about £50m in 2013 - far more than Pfizer was charging in any other European country.
Pfizer was handed a record £84.2m fine, while Flynn Pharma was fined £5.2m.
The CMA has also ordered both firms to reduce their prices for the anti-epilepsy drug.
The CMA said that before September 2012, Pfizer made and sold phenytoin sodium capsules to UK wholesalers and pharmacies under the brand name Epanutin and the prices of the drug were regulated.
But Pfizer sold the UK distribution rights for Epanutin to Flynn Pharma in September 2012, which then saw the drug de-branded - or made generic - meaning that it was no longer subject to price regulation.
Both firms then each ramped up the price of the drug, meaning that overnight the NHS saw the cost surge by between 2,300 per cent and 2,600 per cent, according to the CMA.
It said the NHS at one stage saw the price of 100mg packs of the drug jump from £2.83 to £67.50.
The NHS had no alternative but to pay, as epilepsy patients who are already taking phenytoin sodium capsules should not usually be switched to other products due to the risk of loss of seizure control.
Philip Marsden, chairman of the case decision group for the CMA’s investigation, said: “The companies deliberately exploited the opportunity offered by de-branding to hike up the price for a drug which is relied upon by many thousands of patients.
“These extraordinary price rises have cost the NHS and the taxpayer tens of millions of pounds.”
He added: “This is the highest fine the CMA has imposed and it sends out a clear message to the sector that we are determined to crack down on such behaviour and to protect customers, including the NHS, and taxpayers from being exploited.”
The CMA said Pfizer and Flynn Pharma abused their dominant positions in the market by over-charging for the drug.
Pfizer claimed the anti-epilepsy drug Epanutin was loss-making before it was de-branded, but the CMA found that any losses would have been recouped within two months of the price rises.
Both firms have now been given up to four months to reduce their prices, to ensure there is no risk to the supply of the drug to patients who rely on it.
The CMA said the firms could charge prices which are profitable, but they must not be excessive and unfair.
The fine comes after GlaxoSmithKline and a number of generic pharmaceuticals were hit with a £45m penalty in February after a “pay-to-delay” scandal surrounding blockbuster anti-depressant drug Seroxat.
Glaxo was found to have made more than £50m of payments to companies making cheaper generic versions of Seroxat to delay them coming to market.