Shops with cash machines have had to pay higher business rates since 2013, when the governments Valuation Office Agency department said they would be subject to separate business rates.
The decision was backdated to 2010, and retailers were faced with large bills from their local councils.
The number of cash machines liable for business rates tax in England and Wales rose from 3,140 in 2010 to 15,422 this year.
Councils had an incentive to charge the higher rates on the machines because they have been able to keep 50pc of any business rate increases since 2012.
Normally councils keep a percentage of the business rates they collect, then pass the rest to the Treasury.
The tax decision threatened shoppers access to cash, already jeopardised by the closure of many regional banks and building societies.
But supermarkets Tesco, Sainsburys and the Co-operative, as well as cash machine operator Cardtronics Europe, launched a £300m appeal against the decision.
Supermarkets argued that these machines are not part of their shops and so should not be included in rates calculations.
The Appeal Court today backed the supermarkets and said the machines will no longer be subject to the extra taxes.
The Appeal Court judgment by Lord Justice Lindblom said: "I would allow the appeals of Sainsbury, Tesco, the Co-op and Cardtronics, and dismiss that of the Valuation Officers."
Altus Group said this year taxes on the machines have raised £44.54m in England and Wales, and the ruling will mean tax rebates going back to April 2010.
The decision applies to so-called hole in the wall cash machines that are built into the outside of buildings.
The court of appeal ruled on Friday that cash machines located both inside and outside stores should not be liable for additional business rates, which are a form of property tax on businesses collected by the government.
Several retailers including Tesco, Sainsburys and the Co-op had fought in the courts against the tax rules set by the Valuation Office Agency – the arm of HM Revenue and Customs responsible for setting business rates – which had claimed that ATMs should be additionally assessed.
The court verdict means the supermarket chains are in line for a multimillion pound windfall from tax refunds, which the property advisory company Colliers estimates is worth about £500m.
The case dates back to a 2013 decision by the government to charge rates on hole-in-the-wall cash machines, which was backdated to 2010.
Although the refund is small compared to the £1.8bn annual business rates liability for the four biggest supermarket firms – Tesco, Sainsburys, Asda and Morrisons – it does however come at a time when high street retailers are facing growing pressure from online rivals who pay less in tax.
A spokesperson for the Co-op suggested that the victory would help it keep cash machines at its stores, helping people who rely on them as high street banks shut branches up and down the country.
The case had threatened the viability of the ATM network and risked the future of much-needed banking services across communities.
Banks have been heavily criticised by MPs for closing hundreds of branches in recent years, particularly in rural areas, and often leaving consumers with little option but to use supermarket cash machines or ATMs that charge a fee.
Labour estimates that 60 bank branches and 250 free cash machines close every month, and has promised to ban ATM charges and block branch closures to help rejuvenate high streets.
The court of appeal refused to grant the Valuation Office leave to have the case heard in the supreme court, although it can petition for an appeal.
A spokesperson for the agency said: We are considering the implications of the court of appeal decisions.