UK retailer Marks and Spencer has triumphed in its long-running legal battle over whether VAT should be levied on its teacakes.