A deed in lieu of foreclosure has advantages for both a borrower and a lender; mainly the avoidance of time consuming and costly foreclosure proceedings. In addition, the borrower avoids some public notoriety, and may even be able to lease the property back from the lender.
The lender needs to assess certain risks which include, among other things, the risk that the property is not worth more than the remaining balance on the mortgage and that junior creditors might hold liens on the property.