Next was found to have used a tax avoidance scheme called a rate-booster.
The court ruled Next diverted UK profits to foreign subsidiaries to claim tax relief on overseas profits.
Such schemes are a way in which firms avoid corporation tax on foreign profits that are then paid back to the UK parent firm.
Under rules designed to prevent double taxation of company profits, firms were able to claim credit for tax paid on money they made overseas.
But some companies were able to exploit the rules through the creation of artificial arrangements involving what HM Revenue & Customs (HMRC) referred to as "complex circular movements of money between companies in the same group, so they can claim there has been double taxation".
Known as rate-booster schemes, this enabled companies to avoid corporation tax by diverting profits made in the UK to foreign subsidiaries.
The foreign subsidiary then paid tax on those profits - often at a lower rate of corporation tax - before the profits were paid back to the UK parent company.
Finally, the UK parent company received credits from HMRC for the tax already paid by its subsidiary.
As a result, companies were able to claim far more tax had been paid on their overseas profits than was actually the case.
Legal changes in 2005 and 2009 mean rate-booster schemes are no longer possible or attractive, HMRC added.
The Next case is the second to reach court, following a 2013 ruling against P&O Ferries, although the firm appealed against the decision and an appeal judgement is outstanding.
HMRC said about £130m in tax was at stake across 20 rate-booster cases, which were awaiting the P&O and Next decisions.
About 70 rate-boosters have already been conceded by companies that wanted to avoid going to court. This has brought in more than £500m in tax, it added.
HMRC's director general of business tax, Jim Harra, said: "This case shows how HMRC takes effective action against big businesses that try to avoid paying tax through convoluted, artificial avoidance schemes. HMRC expects all businesses to steer well clear of such schemes."
In a statement, Next said it had paid the tax owed to HMRC "some years ago" and that this had been fully accounted for at the time.
The retailer described the dispute between itself and HMRC as "a technical debate around complex legislation" which had now been superseded. It added that current UK law generally allowed companies to "repatriate their profits without a tax charge".

If so, the Oxford University Museum of Natural History might have just the utahraptor for you.
The model of the fearsome predator will be given away free of charge to whoever puts forward the best case on the submission form by 5 August.
It has been owned by the museum since 2000, but has been languishing in its collections store since 2014.
Potential venues will require a clear floor space of 1.6m by 1.2m (5.2ft by 3.9ft), plus some additional room for its tail.
A spokesman said anyone with "an indoor public space that could house this striking Cretaceous creature" could apply.
He added: "The museum would like interested parties to make a statement about why they feel the dinosaur should move in with them."

Overnight visitors from the Republic of Ireland declined by 7% in 2013.
A report for the Department of Enterprise, Trade and Investment (DETI) said "social unrest over parades and flags" had potentially had an impact.
It also said the local tourism industry was worried about "continuing sectarianism and racial prejudice".
The report said there needed to be "concerted action to promote a safe and secure image of Northern Ireland, including targeted marketing".
The review was ordered by DETI minister Arlene Foster last year.
It calls for a need "to deepen the relationship" between the Northern Ireland Tourist Board (NITB) and Invest NI.
It rules out a merger, but suggests a shared office and renaming the Tourist Board either Visit NI or Discover NI.
The recommendations contained in the report have been put out to public consultation.
It calls for an updated strategy and says the Tourist Board needs to improve "partnership working".
"NITB is at a crossroads," the report's author writes.
"Given the board's achievements in recent years... I am confident that NITB will meet the challenge."
High Street retailer Next has been hit with a £22.4m tax bill after a court found it diverted profits made in the UK offshore to avoid paying tax.
[NEXT_CONCEPT]
Is a four-metre long carnivorous dinosaur model just what your school, community centre or library is lacking?
[NEXT_CONCEPT]
An "image problem" may explain a fall in visitor numbers to Northern Ireland from across the border, according to a review of the tourism industry.