"We want your tax, we want your tax, we want your tax for good," goaded tax avoidance campaigners on Twitter at Take That's Gary Barlow.

Barlow, as well as two of his Take That band members Howard Donald and Mark Owen, were caught out investing in a music industry-focused tax avoidance scheme.

Now after a ruling at a tax tribunal, in which the scheme's string-pullers appealed against HMRC's 2012 closure notice on the basis that it was for the sole purpose of avoidance, they face a combined £20m tax bill.

But how did they dodge the taxman?

The trio invested in a scheme developed by entertainment firm Icebreaker Management.

That scheme bought up intellectual property rights, such as for audio and video recordings, which were then used to generate revenue.

The Icebreaker scheme was the "brainchild" of Caroline Hamilton, said the tribunal's Judge Colin Bishopp, a woman who had spent a decade in the entertainment industry raising insurance-backed finance for independent producers.

She claimed the scheme was to help find finance for "innovative and creative projects" in the music industry and offer a return for the investors.

Yet the scheme turned out losses for them.

Icebreaker said in its defence that this is because of the initial capital expenditure involved in buying intellectual property and funding projects that could later produce a profit.

But Judge Bishopp dismissed this as an "illusion".

This expenditure was made to look bigger than it was by the scheme's members borrowing money to fund a large part of their investments, on top of what they could afford to put in already out of their own pockets.

That money circulated around investors, production companies, and back again to the bank with precious little being spent on intellectual property.

In effect, the borrowed money was used to service itself, but was also set against expenditure and ultimately inflated their losses from the scheme.

Moreover, so-called "guaranteed payments" from the production companies invested in by the scheme were often made out of the money that had been initially use to buy the intellectual property rights, rather than any revenue generated by them.

"Neither the borrowings nor the guaranteed payments had, in reality, any connection at all to the intellectual property rights the partnership had acquired," concluded Judge Bishopp, who added that the scheme's funding and payments system was "circular".

So how does investing in a circular, loss-making intellectual property scheme make you money?

Well the investors are entitled to write those losses off against their own tax bills, be it income or corporation tax. The higher the losses, the bigger the tax benefit.

"The underlying, and fundamental, conclusion we have reached is that the Icebreaker scheme is, and was known and understood by all concerned to be, a tax avoidance scheme," said Judge Bishopp in his ruling.

"The aim was to secure sideways relief for the members, and to inflate the scale of the relief by unnecessary borrowing, coupled with the illusion that the borrowed money was available for use in the exploitation of intellectual property rights by the device of the purported payment of a large production fee offset by the equally purported payment of a fee for a share of the resulting revenue."

Judge Bishopp did rule that the Icebreaker investors were allowed to claim a tax benefit in relation to genuine revenue expenditure of the partnerships, meaning the appeal against HMRC's closure notice for the scheme was in part successful.

But they cannot claim tax benefit – and will have to repay amounts already claimed – against the capital expenditure on intellectual property.