Image caption The case famously saw Goldman's chief executive, Lloyd Blankfein, grilled by Congress in April

US bank Goldman Sachs has agreed to pay $550m (£356m) to settle civil fraud charges of misleading investors.

The charges concerned Goldman's marketing of mortgage investments as the US housing market faltered.

US finance watchdog the Securities and Exchange Commission said it was the biggest fine for a bank in its history.

The UK's Royal Bank of Scotland, which is now 84% owned by the UK taxpayer and lost about $840m in investments, will receive $100m compensation.

RBS has indicated that it may sue Goldman for the rest of the money it lost, saying that it would "carefully consider all of its options".

German bank IKB Deutsche Industriebank will receive $150m of the SEC fine, meaning it will recoup all of its losses on the Abacus deal that was the subject of the SEC's investigation.

This is despite the fact that RBS's investment in Abacus actually ranked senior to IKB's investment - meaning that RBS's investment was supposed to be safer.

Some will argue that Goldman Sachs got off lightly Robert Peston, BBC business editor Read Robert's blog

The remaining $300m will go to the US Treasury.

Terms of the settlement are subject to approval by a federal judge.

Misguided investors

The SEC said Goldman had acknowledged that marketing material contained "incomplete information".

In a statement, Goldman did not admit legal wrongdoing but said the move was "the right outcome for our firm, our shareholders and our clients".

Despite the record fine, Goldman shares rose by 4.5%, reflecting the fact that many analysts felt the firm had got off lightly.

"They pay $550 million and they get an $800 million pop in their stock price... they got off easy," said Kevin Caron at Stifel, Nicolaus & Co.

Goldman made a profit of $3.5bn in the first three months of this year.

Housing collapse

In April, the SEC charged Goldman with failing to disclose "vital information" that one of its clients, Paulson & Co, helped to choose which securities were packaged into a mortgage portfolio that was then sold to investors in 2007.

It claimed Goldman did not disclose that Paulson, one of the world's largest hedge funds, had bet that the value of the securities would fall.

The SEC alleged that investors in the mortgage securities, packaged into a vehicle called Abacus, lost more than $1bn (£650m) in the US housing market collapse.

All of that $1bn was then paid out to Paulson, who - unknown to the investors - stood on the other side of the deal as a "short" investor in the deal.

Anger

Goldman, arguably the world's most prestigious investment bank, had escaped relatively unscathed from the global financial meltdown.

Since then, the company has become a lightning rod for anger over Wall Street's profligacy and seeming arrogance.

It received $10bn of government aid under the Troubled Asset Relief Program (Tarp) in 2008 - money that Goldman has said throughout that it did not need.

The company also received a $12.9bn cash payout from AIG - the full amount owed to it - after the failing insurer was saved by the US government in by far the most expensive single bail-out of the financial crisis.

Despite these rescues, Goldman went on to record $12.2bn in profits in 2009, on top of the $16.2bn handed out to staff in pay and perks.