Four surviving spouses of people who had taken out reverse mortgages on their houses filed a class-action lawsuit Thursday against the U.S. Department of Housing and Urban Development, saying HUD had failed to protect them from displacement and foreclosure as required by federal law.

The suit comes nearly five months after a federal court ruled that HUD regulations, which allow banks to foreclose on surviving spouses who are not on the reverse mortgage or force them to pay it off, contradict a federal statute designed to protect them.

HUD declined to comment on the suit.

A reverse mortgage provides cash to homeowners who are 62 or over in exchange for equity in their homes, either as a lump sum or in monthly disbursements. Payment of the loan is deferred until they die, sell, or move out of the house, at which point their heirs can sell the home to pay off the mortgage. The amount of the mortgage can compound to surpass the value of the property. Most reverse mortgages are insured by HUD.

One factor in approving a reverse mortgage is the age of the buyer, and brokers tell couples that they can get more money if only one borrower, almost always the older one, is listed, said Craig Briskin, an attorney with Mehri & Skalet PLLC who is a co-counsel in both suits. To get the loan, the non-borrowing spouse must also be removed from the title.

“They don’t tell them that you’re not protected if you die,” he said.

Although reverse mortgages have been around since 1988, they were not widespread until the 2000s; there are now 600,000 outstanding reverse mortgages, according to Jean Constantine-Davis, a senior attorney with AARP Foundation Litigation and a co-counsel in both suits.

The problems for surviving spouses arose after the 2008 housing collapse, when many homes lost equity, Briskin said.

“They didn’t treat the spouse as a homeowner at all.”

The plaintiffs in the suit live in Nevada, Massachusetts, Florida, and California. It is unclear how many additional surviving spouses are in this situation, but it is “likely thousands,” Constantine-Davis said.