Goldman Sachs Group Inc and investment adviser TCW have survived an appeal by a German bank that sued them for fraud over a toxic derivative marketed at the height of the housing market bubble.

The 2nd Circuit Court of Appeals on Thursday upheld the dismissal of the lawsuit - brought by state-owned Landesbank Baden-Wurttemberg - by a trial judge last September.

It was one of the few cases to reach the appellate level in which a sophisticated investor accused a bank of profiting unjustly by being negligent in marketing and selling a product.

The complaint in this case does not ascribe to Goldman or TCW any particular motive for committing fraud beyond a general profit motive common to all corporations, which does not suffice, a written ruling by a panel of three judges said.

The lawsuit was brought over a collateralized debt obligation (CDO), Davis Square Funding VI, which was managed and marketed by Goldman and TCW Asset Management Co at the height of the housing bubble when profits were potentially lucrative. The lawsuit was filed in October 2010, about four years after Davis Square closed.

The CDO's underlying portfolio comprised about 95 percent residential mortgage-backed securities, which lost value as the housing market crashed in 2007 and 2008.

The German bank's lawsuit said it lost its investment of $37 million.

In Thursday's written ruling, the panel said Landesbank and Goldman and TCW had a standard relationship of buyer and seller. It said that by its own representations, Landesbank possessed sufficient expertise to evaluate the risks of its investment. The complaint therefore fails to plead justifiable reliance.

It also said Landesbank failed in its claim of unjust enrichment by Goldman and TCW.

Arthur Miller, a lawyer who argued for Landesbank in March, could not immediately be reached for comment.

The case is Landesbank Baden-Wurttemberg vs. Goldman Sachs and TCW Asset Management Co, 2nd Circuit Court of Appeals in New York No. 11-4443.

(Reporting By Grant McCool; editing by John Wallace)