The lender is subrogated to the third party's rights against the borrower to collect as much of the debt as was discharged.
The lender gets all the rights that the original person who was owed the money had.