Supermarkets and convenience stores have been liable to pay millions of pounds in rates on machines since 2010.
But the Appeal Court has ruled that about £300mln that retailers have been charged will be refunded, with some of the money to come from the government and local authorities.
The court said the Valuation Office, which brought the original case, will not be allowed to appeal to the Supreme Court. However, it can still petition the Supreme Court.
Tesco said: "We recognise the vital role that ATMs play in the daily lives of our customers and remain committed to providing this service to them.
"We welcome today's result and the confirmation of our belief that ATMs should not be separately rateable."