The case was taken against Vardy Property Group, which had been using an aggressive SDLT avoidance scheme also being promoted by several accountancy firms.
A company in the Vardy Group had acquired a business park for £7.25m, which would have incurred a SDLT of £290,000.
Instead, the group structured the purchase through a newly-formed unlimited company, which immediately distributed the property as a dividend to the shareholder company.
The decision in HMRC’s favour, subject to any appeal, could save the UK Exchequer more than £170m.
The government has also created rules that will force users of a wider range of stamp duty land tax avoidance schemes to disclose the schemes to HMRC.
The new rules will give HMRC much better access to information about these avoidance schemes and those who promote and use them. They can then be challenged and closed down more quickly.
HMRC’s director general of business tax, Jim Harra, said: “This victory sends a clear message to tax avoiders that we will challenge avoidance relentlessly.
“The decision is good news for the vast majority of taxpayers who pay, rather than try to dodge, their taxes.
“It shows that the courts will see through arrangements which are put in place just to avoid tax.
“People who are tempted by tax advisers to enter into avoidance schemes should think twice and not be driven by greed into signing up for schemes that are just too good to be true.”