In case you haven’t noticed, California is the kingdom of home owner protection, extending from real estate law protecting homeowners and tenants to the lemon law. Let’s take homeowners first.
With the bursting of the housing bubble homeowners have benefitted again from a series of consumer homeowner protection laws passed in Sacramento during the Great Depression. The object was to shift the risk of mortgaging a house from the borrower to the lender. These laws are collectively known as the anti-deficiency laws, a deficiency being the loss suffered by the lender after foreclosure when the house turns out to be worth less than the amount borrowed against it.
The most important real estate law prohibits the lender from seeking a deficiency against the borrower if the lender forecloses by a trustee’s sale, because the only alternative to a trustee's sale foreclosure is a judicial foreclosure. That requires a lawsuit and concludes with good news and bad news for the lender. The good news is that the borrower is liable for the deficiency. The bad news is that the borrower has a year to "redeem" the house from the lender by paying off the loan. In short the lender is stuck with the house for the duration of the lawsuit and for the following twelve months. Lenders find this worse than being denied a deficiency - even though trustee’s sale foreclosures usually take at least four months - so in practice there are no judicial foreclosures with deficiencies. There are only trustee's sale foreclosures with no further liability for the borrower.
The second most important California real estate law prohibits the lender from seeking a deficiency against the borrower if the loan was used to purchase the house. This might seem redundant in light of the trustee's sale/no deficiency rule, but it isn't. If there are two mortgages (a "first" and a "second") and the first is foreclosed by a trustee's sale, the second becomes an ordinary unsecured loan, the trustee's sale/no deficiency rule doesn't apply to it, and the borrower is personally liable for all of it - unless the second was used to purchase the house. This was the case with no longer available “80/20" financing, even if the first and second were made by different lenders. The moral here for deficiencies is that the consumer-as-borrower with only one mortgage always escapes and still escapes even with two as long as the second is a “purchase money” mortgage.The borrower is up the creek if the second isn't a "purchase money" mortgage, and if it is large the borrower's only salvation may be a trip to bankruptcy court. There is also the problem of taxable forgiveness of debt income to borrowers following trustee's sale foreclosures of non-purchase money first mortgages - the lender's monetary loss is taxed as ordinary income to the borrower as if the borrower had received the money. Previous owners who refuse to vacate voluntarily after foreclosure become tenants.
Please see Landlord Tenant Law for more information.