There are different mechanisms for loan investment protection and they largely depend on the type of loan you are investing in.
For consumer loans, there is usually a buyback obligation and a group guarantee available. They ensure that the lending company issuing the loans repays the investment and interest if the end borrower (consumer) fails to meet its obligations towards you.
Real estate and agriculture loans rarely have any guarantees from lending companies. Instead, they have collateral in a form of real estate, land, heavy machinery, etc. that serves as an additional safety if a borrower was to fail.
Additionally, various loan marketplaces may have different security structures and mechanisms in place to ensure that investors are protected and repaid.