Confusion over the chocolate-covered teacake - a dome of marshmallow on a biscuit swathed in milk chocolate - could cost the British government £3.5m after an EU court adviser said the retailer Marks & Spencer should get a refund of the tax it paid during the decades that tax authorities insisted they were biscuits.

The European court of justice's advocate general said in an opinion - which is not binding on the court but is often followed in final rulings - that a company had the right to a full refund of any sales tax wrongly charged.

Marks & Spencer is challenging British tax authorities' refusal to pay out the £3.5m wrongly charged on chocolate-covered teacakes from 1973 to 1995.

Britain saw the error of its ways in late 1994, agreeing that the items were cakes and should not be charged any value-added tax. But it would give Marks & Spencer only a fraction of the tax paid in 1997: £88,440.

The EU court's adviser, Juliane Kokott, said Britain was wrong to refuse the refund by claiming that such a large payment would be "unjust enrichment" - offering a profit to the retailer when it had passed on the extra tax charge to customers. "The objection that Marks & Spencer has been enriched cannot be invoked as long as it offends the principle of equal treatment," she said, criticising the British tax system for not applying unjust enrichment rules across the retail chain.

When the court rules on the issue, its recommendations will be passed to the House of Lords, which will decide on the details of the chain's appeal.