Joining a broad settlement into alleged foreclosure abuse, Goldman Sachs (GS) and Morgan Stanley (MS) reached a deal on Wednesday to pay $557 million to help mortgage borrowers.

The agreement is tied to a federal investigation into deficient practices in mortgage loan servicing and foreclosure processing such as robo-signing.

The Federal Reserve said Goldman and Morgan Stanley agreed to pay $232 million in direct payments to eligible borrowers as well as $325 million in “other assistance,” which includes loan modifications and forgiveness of deficiency judgments.

The deal paves the way for compensation for more than 220,000 borrowers whose homes were foreclosed on in 2009 and 2010 with former subsidiaries of Goldman and Morgan Stanley.

Compensation for eligible borrowers is expected to range between hundreds of dollars to $125,000, depending on the servicer error.

Goldman Sachs and Morgan Stanley have since divested the mortgage-servicing businesses in question: Litton Loan Servicing and Saxon Mortgage Services, respectively.

The Fed said eligible borrowers can expect to be contacted by the end of March by a payment agent who will be appointed to administer the process. Borrowers won’t be required to sign a waiver of any legal claims they may have against their mortgage servicer in exchange for payment, the government said.

The news comes a week after the Fed and the Office of the Comptroller of the Currency reached a similar deal with a range of banks, including Bank of America (BAC), Citigroup (C), J.P. Morgan Chase (JPM), PNC (PNC), U.S. Bank (USB) and Wells Fargo (WFC).

Taking into account the agreement announced on Wednesday, the Fed said more than four million borrowers will now receive a total of $3.5 billion in cash compensation and an additional $5.5 billion for mortgage assistance.

The Fed said it is in talks to reach similar agreements with other mortgage servicers.

Shares of Goldman Sachs rallied 2.53% to $139.00 Wednesday morning amid enthusiasm for the company’s big fourth-quarter earnings beat, while Morgan Stanley gained 0.39% to $20.52.

Follow Matt Egan on Twitter @MattMEgan5