But the cities face an uphill battle. Some have already backed off, and those that proceed will be challenged in court. After San Bernardino County dropped the idea earlier this year, a network of housing groups and unions began working to win community support and develop nonprofit alternatives to Mortgage Resolution Partners, the firm that is managing the Richmond program.

“Our local electeds can’t do this alone, they need the backup support from their constituents,” said Amy Schur, a campaign director for the national Home Defenders League. “That’s what’s been the game changer in this effort.”

Richmond is offering to buy both current and delinquent loans. To defend against the charge that irresponsible homeowners who used their homes as A.T.M.’s are being helped at the expense of investors, the first pool of 626 loans does not include any homes with large second mortgages, said Steven M. Gluckstern, the chairman of Mortgage Resolution Partners.

The city is offering to buy the loans at what it considers the fair market value. In a hypothetical example, a home mortgaged for $400,000 is now worth $200,000. The city plans to buy the loan for $160,000, or about 80 percent of the value of the home, a discount that factors in the risk of default.

Then, the city would write down the debt to $190,000 and allow the homeowner to refinance at the new amount, probably through a government program. The $30,000 difference goes to the city, the investors who put up the money to buy the loan, closing costs and M.R.P. The homeowner would go from owing twice what the home is worth to having $10,000 in equity.

All of the loans in question are tied up in what are called private label securities, meaning they were bundled and sold to private investors. Such loans are generally the most unfavorable to borrowers and the most likely to default, Mr. Gluckstern said. But they are also the most difficult to modify because they are controlled by loan servicers and trustees for the investors, not the investors themselves. If Richmond’s purchase offer is declined, the city intends to use eminent domain to condemn and buy the loans.

The banks and the real estate industry have argued that such a move would be unprecedented and unconstitutional. But Mr. Hockett says that all types of property, not just land and buildings, are subject to eminent domain if the government can show it is needed to promote the public good, in this case fighting blight and keeping communities intact. Railroad stocks, private bus companies, sports teams and even some mortgages have been subject to eminent domain.