The so-called "big four" accountancy firms are using knowledge gained from staff seconded to the Treasury to help wealthy clients avoid paying UK taxes, a report by the influential Commons public accounts committee says.

Deloitte, Ernst & Young, KPMG and PricewaterhouseCoopers have provided the government with expert accountants to draw up tax laws. But the firms went on to advise multinationals and individuals on how to exploit loopholes around legislation they had helped to write, the public accounts committee (PAC) found.

Margaret Hodge, the PAC's chair, said the actions of the accountancy firms were tantamount to a scam and represented a "ridiculous conflict of interest" which must be stopped. "The large accountancy firms are in a powerful position in the tax world and have an unhealthily cosy relationship with government," she said, calling for the Treasury to stop accepting their staff to draw up new tax laws.

The report comes after David Cameron on Thursday set out plans to use Britain's chairmanship of the G8 to tackle what he described as staggering worldwide levels of tax evasion and avoidance.

The PAC claims HM Revenue and Customs had to seek outside help because it was engaged in a "battle it cannot win" in seeking to stem the losses to the exchequer from tax avoidance.

The accountancy giants employed almost 9,000 staff and earned £2bn a year from their tax work in the UK, and £25bn globally, the report claims. MPs found that Revenue and Customs had far fewer resources, particularly in the area of transfer pricing: complex transactions deployed by multinational companies in order to shift taxable profits to low tax jurisdictions. "In the area of transfer pricing alone, there are four times as many staff working for the four firms than for HMRC," the report says.

The committee highlights the way the firms seconded staff to the Treasury to advise on issues in the drafting of legislation. "Through their work in advising government on changes to legislation they have a detailed knowledge of UK tax law, and the insight to identify loopholes in new legislation quickly," it said.

One example in the report is that of KPMG, whose staff advised on the development of "controlled foreign company" and "patent box" rules, and then issued marketing brochures highlighting the role they had played. The brochure "Patent box: what's in it for you" had, it said, suggested the legislation represented a business opportunity to reduce tax and that KPMG could help clients in the "preparation of defendable expense allocation".

The committee is "very concerned by the way that the four firms appear to use their insider knowledge of legislation to sell clients advice on how to use those rules to pay less tax", the report adds.

The report was welcomed by Prem Sikka, professor of accounting at University of Essex. "They [the big four] are the epicentre of a global tax avoidance industry and the loss of tax revenues is directly responsible for the current economic crisis. The Treasury should follow the US authorities and prosecute and fine the firms. The habitual offenders should be shut down," he said.

Officials from HMRC rejected criticisms that tax officers were not making progress in tackling avoidance. "The facts show that we are not only aggressively fighting battles against tax avoidance, but we are winning them," a spokesman said.

KPMG said in a statement: "When requested to by government departments we do provide individuals on secondment. Their role is to provide tax technical input and commercial experience so that the authorities can make informed choices on tax policy. Our secondees do not write legislation or make policy decisions."

Bill Dodwell, head of tax policy at Deloitte, said: "We do not believe that there has ever been any conflict of interest but would want to help ensure that there is no perception of conflict." Kevin Nicholson, head of tax at PwC, said: "We provide technical insight to government but only when asked and are never involved in deciding tax policy which is a matter for the government."

In evidence to the committee, John Dixon, Ernst and Young's head of tax, said: "I think there are benefits in the work we do with government ... benefits to the country at large. If you look at the quality of the legislation that we now have ... it is a lot better than it was 10 years ago.

"Why is that? Because we are actively working with government, at our cost, to make sure that the legislative footprint we are working with is as clear and concise as it can possibly be."

An HMRC spokesman said: "HMRC gives careful consideration to the potential risks, as well as how to mitigate any potential conflicts of interest, before any such secondments are agreed. On balance, the carefully targeted use of secondees is beneficial for the development of tax policy and improving the effectiveness of the tax system."

Cameron, who hopes to use an EU summit in May as a stepping stone to a wider agreement at the G8, wrote to all EU leaders proposing:

• Rapid movement to a global system of information exchange to help tackle tax evasion including through the use of offshore trusts.

• Action plans by G8 countries to produce full transparency, breaking through walls of corporate secrecy and establishing central public company registries.

• Voluntary deals for multinational firms to make clear the tax they pay in every country they operate in.

• Implementation of the EU accounting directive so developing countries can access information on payments to governments made from the oil, gas and mining industries.