Pharmaceutical firms Pfizer and Flynn Pharma have been hit with the biggest ever fine from the Competition and Markets Authority (CMA) for charging excessively for an anti-epilepsy drug.

Pfizer has been told to pay £84.2m ($106.4), while distributor Flynn has been ordered to pay £5.2m.

The fine relates to the price of phenytoin sodium capsules – a vital drug for around 48,000 patients in the UK – going up 2,600% overnight in 2012.

The CMA ruled that the price increase was "excessive and unfair" and had cost the NHS tens of millions of pounds. The UK price of the drug was far higher than in other European countries, it added.

NHS' expenditure on the capsules increased from about £2m a year in 2012 to around £50m the next year.

Philip Marsden, chairman of the case decision group for the CMA's probe, 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. Businesses are generally free to set prices as they see fit but those holding a dominant position should not abuse this situation and set prices that are excessive and unfair. There is no justification for such rises when phenytoin sodium capsules are a very old drug for which there has been no recent innovation or significant investment."

Pfizer marketed phenytoin sodium capsules under the name Epanutin before it sold the distribution rights to UK-based Flynn in 2012. After the sale, the drug was debranded and its price soared dramatically.

Pfizer plans to appeal against all aspects of the CMA's verdict, according to reports.

The US company told Reuters that it was incurring losses on the medicine and was forced to consider whether it could continue supplying it.

The CMA has given Pfizer and Flynn up to four months to reduce the price of phenytoin sodium capsules to ensure that there is no risk to the supply of the drug for the patients who depend on it.