The claims made by specialist accountancy firms are beguiling. Running a successful business? You can cut your income tax bill to "virtually zero". Earning a fortune? You can "have your cake and eat it". Concerned HM Revenue & Customs (HMRC) won't like it? Don't worry – many of the staff at the accountancy firms previously worked there and know their way around.

At the heart of the tax-saving claims are controversial loans which companies can make to an individual rather than paying them a salary, thereby avoiding income tax. Earlier this week the spotlight fell on one scheme, alleged to be used by thousands of wealthy individuals, including the comedian Jimmy Carr.

An investigation by the Times accused the presenter of Channel 4's 8 Out of 10 Cats and 10 O'Clock Live of sheltering £3.3m a year through the scheme, called K2. The arrangement was publicly criticised by David Cameron, and Carr now says he has changed his tax affairs, apologising for what he called "a terrible error of judgment".

There is nothing new in companies loaning money to directors, or even to staff. Annual season ticket loans have been around for decades and are approved by HMRC. But what is striking is how company directors have begun to use loans, particularly from their pension schemes, to exploit extraordinary loopholes in the tax system.

One chief accountant of a major national accountancy firm explained to Guardian Money how wealthy individuals can avoid income tax almost completely through "employer-financed retirement benefit schemes" (EFRBS). But he was only willing to detail the schemes on condition of anonymity.

In traditional pension schemes used by the majority of employees, both the company and the individual receive tax relief on their contributions. But there are strict rules about where the money can be invested. For example, you can't use a company pension to invest in residential properties, particularly your own home. The amount of tax relief is also capped on any contributions above £50,000 a year. And under no circumstances can you take a loan from your pension scheme.

But it's different for directors. Let's say a director is paid £2m. At the current marginal rate of 50%, nearly half of his or her earnings will go in tax. But if the company pays the director just £50,000 and puts the other £1,950,000 into an EFRBS, and then the next day he or she borrows £1.9m from the pension scheme to spend as they like, the tax bill will be almost nothing.

The company does not receive tax relief on the payment into the scheme as it's above the £50,000 ceiling and therefore not "approved" – but it is also not subject to the same investment restrictions, including the bar on loans. There will be no tax to be paid on the loan – after all, it's not income, it's a loan and will supposedly have to be repaid one day. The only tax is on the £50,000 paid out as salary.

"These structures work so long as everyone agrees that the loan is repayable … but that's where the smoke and mirrors come in. There is a nod and a wink that the pension scheme will never ask for the money back, and the loan stays in place for perpetuity, until the person dies. At death, it disappears. The trustees of the pension scheme meet and agree to write it off," said our tax expert.

So during that time the individual has taken an income, spent it and not had to pay a penny in income tax.

Of course nothing in tax is quite as simple as the example above. HMRC has strict rules about EFRBS, and has put in place legislation to catch "disguised remuneration". Many directors do, of course, repay the loans and pay their tax in full.

Many accountants refuse to enter into such "aggressive" tax avoidance schemes, on the basis that they carry a high risk that HMRC will later shut them down. "They tend to be set up by very, very clever people, mostly specialist tax lawyers. But some are so aggressive, and in this business, our reputation is everything," says Richard Godmon, partner at Menzies, an accountancy firm that specialises in owner-managed businesses (who is not the anonymous expert quoted above).

"Only a tiny percentage of clients are prepared to enter into aggressive strategies. When we explain it to them, they say 'I'd rather sleep at night.' They don't want these schemes to come back and haunt them in three or four years' time."

Godmon explains that directors' loans, outside of the EFRBS pension arrangements, are more common and less aggressive, but still attractive.

"There is nothing to stop your company lending you money," he says, but you are taxed as if it were an employee benefit. HMRC assumes you would have paid 4% interest on the loan if you had borrowed it on the open market. If you are a 50% taxpayer, that means you have to pay a 2% tax charge, but every year. What's more, the company making the loan has to pay 25% of the amount of the loan to HMRC, which is repaid when the loan is repaid by the individual. "Directors' loans can be a tax-efficient way of accessing funds over the short term, such as for buying a home," says Godmon. "We have lots of clients who use them over the short term only."

Can directors avoid repaying the loan (and any tax) by dissolving their company? It's possible – once a company is struck off Companies House, essentially all balances due to the company cease. But HMRC may reject strike off applications if it feels there is unpaid tax.

Many Premier League footballers have been named as cashing in on directors' loans. Typically, they have two contracts with their club – one as a footballer, where they earn a salary and pay income tax, and one for their "image rights". The fee for their image rights is paid to their company, and then the footballer takes a loan against that fee – thereby paying just 2% tax – until (or if) the loan is repaid.