A federal judge has ruled that Bank of America Corp cannot have a lawsuit by investors seeking to force it to buy back mortgages heard in federal court, saying he lacks jurisdiction to decide the case.

Tuesday's ruling by Judge Richard Holwell of the U.S. District Court in Manhattan means the case will move to state court. Holwell did not decide the merits of the case.

Congress passed two statutes within a year of each other to address the mortgage crisis, the judge wrote. In neither of these statutes did Congress federalize the case.

The ruling is a win for investors, to the extent that Holwell rejected a claim by the bank's Countrywide Financial Corp unit that new federal laws to encourage loan modifications to help struggling borrowers stay in their homes govern this case.

Countrywide had argued that the laws negated obligations it might have had to buy back modified loans. In 2008, Countrywide agreed with some 11 state attorneys general to modify $8.4 billion of loans made to roughly 400,000 borrowers.

Investors who own mortgage securities typically receive interest and principal payments. If servicers modified the underlying loans to reduce borrower obligations, investors would be harmed because they would receive lower payments.

Holwell did rule that investors bear the burden of showing that pooling and servicing agreements for their loans, taken as a whole, require Countrywide to buy back the loans.

Bank of America could not immediately be reached for comment. A published report said a spokeswoman agreed that the court did not rule on the merits of the plaintiffs' claims.

The current case was brought by two investment funds holding Countrywide mortgages, Greenwich Financial Services Distressed Mortgage Fund 3 LLC and QED LLC.

These investors complained they would be harmed if Countrywide shifted the burdens of loan modifications to 374 trusts into which loans had been repackaged and securitized.

These investors would rather Countrywide repurchase modified loans for the full unpaid amounts.

Countrywide had been the largest U.S. mortgage lender before Bank of America acquired it last July for $2.5 billion.

The case is Greenwich Financial Services Distressed Mortgage Fund 3 LLC and QED LLC v. Countrywide Financial Corp, U.S. District Court, Southern District of New York (Manhattan), No. 08-11343.

(Reporting by Jonathan Stempel, with additional reporting by John Tilak in Bangalore)