If your friend's home is subject to a foreclosure proceeding and if you enter into a lease for it as a tenant, you as a tenant would be protected from being evicted for the term of the lease and if it is a month-to-month lease, you have at least 90 days to remain in the rental.There is the possibility that the lender may deem that the lease between you and your friend done in bad faith since you two are friends and the property is in foreclosure. Most likely you can live in the property rent free and perhaps when the property is foreclosed upon, the new owner may pay you cash for the keys to the premises.