Southwark Crown Court heard how the criminals used the money to buy fast cars and rent luxury apartments in London.
Investigators from HM Revenue and Customs found £360,000 in cash as well as weapons when they arrested the gang.
The gang attempted to claim more than £8m in tax repayments after submitting self-assessment tax forms in the names of fictitious migrant labourers.
Significant numbers of tax returns were identified by HMRC as fraudulent and the repayments were stopped.
In order to carry out the crimes the gang created thousands of false identities using false passports and other faked documents. They opened over 750 bank accounts to receive the tax repayments and then launder the proceeds.
The West London-based gang submitted at least 1,600 online Self Assessment tax returns for fictitious foreign migrant workers, falsely claiming that they had worked in the UK and overpaid income tax.
HMRC officers searched seven properties in Brentford, West London in July 2009 where they uncovered a production line of fraud.
Each member of the crime group was assigned specific roles to carry out the fraud; one address contained hundreds of bank cards, another held National Insurance number application forms.
A third address contained hundreds of thousands of pounds in cash and weapons were found at a fourth property. HMRC arrested the gang on site and seized £360,000 in cash.
Peter Millroy, Assistant Director of Criminal Investigation for HMRC, said: “This was a calculated criminal plot motivated by greed, which deprived the nation’s public services of millions of pounds.
“We will not stop in our pursuit to bring those involved in this type of criminal activity before the courts and will work tirelessly to recover the proceeds of their crime for the public purse.
“HMRC takes fraud extremely seriously. In common with commercial financial organisations, we face attempts by individuals and organised criminals to steal from us and we have processes in place to detect and counter fraudulent repayments claims. These are kept under constant review to ensure we are able to deal effectively with ever evolving threats.”