Ocwen's shares were up 7.3 percent at $10.30 in premarket trading on Monday. The stock has lost about three quarters of its value in the past year.
The portfolio comprises about 81,000 performing loans owned by government-controlled mortgage finance firm Freddie Mac.
The U.S. Federal Housing Finance Agency (FHFA) runs Freddie Mac and Fannie Mae through conservatorships after they were bailed out by taxpayer money during the financial crisis.
"This transaction represents the first step in the execution of our previously announced strategy to transfer certain types of non-strategic servicing," Ocwen Chief Executive Ronald Faris said.
Mortgage servicers such as Ocwen have grown exponentially since the financial crisis by buying up the rights to service mortgages after new capital regulations made the business too costly for banks to maintain.
But investments in systems and procedures did not keep pace with their expansion, causing headaches for many homeowners.
Ocwen had to pay $150 million in penalties in December related to improper foreclosures. As part of the settlement, the company's founder and chief executive stepped down.
Ocwen and Nationstar expect the transaction to close by March 31.
Nationstar's shares were up 4 percent before the bell.