A Suffolk dog food company could receive a £9m tax rebate after unnecessarily paying VAT for 29 years.
Skinner's, in Stradbroke, said it paid the tax between 1980 and 2009 on food which should have been exempt as it was targeted at working dogs not pets.
Tax tribunal judge Barbara Mosedale has ruled in the favour of Skinner's, who had seen two claims refused by HM Revenue and Customs (HMRC) in 2009.
HMRC said it was considering the decision and whether to appeal.
The tribunal claim centred around five types of dog food, which owner Roger Skinner said from 1979 had been marketed towards, and sold to, the "niche" market of working dog owners.
VAT is paid on food sold for pets - defined as an "animal tamed and kept as favourite or treated with fondness" - but not for working dogs, which are "not kept primarily as objects of affection".
Judge Mosedale's ruling said advertising for the foods had been placed in working dog magazines, such as the Shooting Times, and the food was mainly sold in 20kg bags - not typical for pet food.
She said Skinner's did not consider its products to be pet food, and neither did its customers.
Judge Mosedale said it was not her responsibility to rule on the amount potentially owed, she said, but purely to give a preliminary ruling on whether the dog food should have been "standard rated or zero rated".
She ruled in principle that Skinner's products, apart from the sales of its Ruff and Ready range from 2000 onwards, should have been exempt of VAT.
Skinner's had paid nearly £7m in VAT in the 29-year period, but hopes to retrieve £9m.
Mr Skinner said: "We were in the process of planning a new factory, and that will be very helpful in bringing it on sooner than it might have been."
A spokesperson for HMRC said: "HMRC is considering this decision carefully, before deciding whether to appeal."