WASHINGTON—A U.S. housing-finance regulator on Wednesday announced steps to ease strains on mortgage companies facing a cash crunch as millions of Americans suspend their monthly payments amid the coronavirus pandemic.

The Federal Housing Finance Agency said it would allow mortgage-finance giants Fannie Mae and Freddie Mac to buy home loans that recently entered forbearance—meaning borrowers have stopped making payments—while charging steep fees that may diminish interest from lenders.

“Purchases of these previously ineligible loans will help provide liquidity to mortgage markets and allow originators to keep lending,” FHFA Director Mark Calabria said in a statement.

The policy, which was reported earlier by The Wall Street Journal, will apply to mortgages used to purchase new homes and some refinanced mortgages that lenders were poised to sell to Fannie and Freddie before the borrowers sought forbearance shortly after closing on their loans.

The loans will be priced “to mitigate the heightened risk of loss” to Fannie and Freddie, the FHFA said in a statement.

Lenders will be charged fees equivalent to 5% to 7% of the value of the loan. For example, a lender who makes a loan of $200,000 might be charged $10,000 or more to sell the loan.

Industry officials were hoping the steps would help nonbank mortgage companies, which typically lend to home buyers and then quickly sell the loans to Fannie and Freddie.

That strategy was upended recently when Fannie and Freddie said they wouldn’t buy loans in forbearance, leaving unsalable loans piling up on the books of the mortgage companies that both originate and service home loans.

Millions of Americans are skipping mortgage payments as the coronavirus pandemic causes unemployment to soar. As of April 12, 5.95% of home loans were in forbearance, up from 3.74% on April 5, according to data released by the Mortgage Bankers Association on Monday. In a separate analysis, the American Enterprise Institute said 3.5 million borrowers were in forbearance through Sunday.

Fannie and Freddie don’t make loans but instead buy them from lenders and package them into securities that are sold to investors. The companies have been under government control since they were nationalized in the 2008 financial crisis.

Historically, Fannie and Freddie haven’t bought loans on which borrowers had stopped making payments, as they were considered delinquent. But the roughly $2 trillion stimulus law passed by Congress last month allowed homeowners harmed by the pandemic to suspend payments for as long as a year without penalty—and it says such loans should be reported as current, rather than delinquent.

Mortgage lenders and servicers also face a severe cash crunch for another reason: they must continue paying investors in the loans even if homeowners suspend their monthly payments. On Tuesday, the FHFA said it would cap at four months the period of time mortgage companies are on the hook for payments on behalf of borrowers who are in arrears.