The "sweetheart" tax deal between HM Revenue and Customs and Goldman Sachs was procedurally flawed but not unlawful, the High Court has ruled.
A judge listed a number of HMRC failings, including Dave Hartnett, then permanent secretary for tax, wrongly taking into account "the potential embarrassment" to Chancellor George Osborne if the settlement worth up to £20 million did not go through.
Mr Hartnett initially shook hands on the deal on November 19, 2010 following a long-running dispute with Goldman Sachs over National Insurance contribution payments dating back to the 1990s.
Mr Justice Nicol, sitting in London, said it was "not a glorious episode in the history of the Revenue". But he ruled case law showed that "maladministration and illegality" were separate issues, and allowing the deal to go ahead was not itself unlawful.
Tax authority lawyers defended the settlement, saying it was among five big business deals declared "reasonable" by a 2012 report of the National Audit Office (NAO) .
The judge's ruling came as "a disappointment" to campaign group UK Uncut Legal Action who had applied for judicial review, arguing HMRC's list of failings involved illegality and a breach of statutory duty.
The group complained that an "aggressive" bank had been "rewarded" for several years of failing to pay tax it owed, causing "real disquiet among the taxpaying public".
Murray Worthy, a director of the group, said he was disappointed, but added: "This case has shown that the Government's tough talk on tax is just that - talk not substance."
Jim Harra, HMRC's director-general for business tax, disagreed and said: "The High Court's comprehensive dismissal of UK Uncut's claim puts to rest the fallacy that HMRC is soft on large businesses. HMRC has an exemplary record in relentlessly challenging those who avoid tax."
UK Uncut says it is wrong to allow rich companies to avoid paying millions in tax while the Government imposes tough austerity measures on the poor and ordinary taxpayers are pursued for every penny.