Taking a sham guarantee doesn't invalidate the loan or the core collateral, it just means you won't be able to pursue the guarantor personally to collect a deficiency on a real estate secured loan following foreclosure.
As defined by the courts, a sham guarantee is one that is unenforceable because it was structured for the purpose of circumventing California's single action and anti-deficiency rules.
These laws were developed years ago as a result of lenders who took advantage of unsophisticated buyer/borrowers. A practice had developed in some arenas to inflate the value of the property in a sale, lend against that value and then when borrowers could not pay, and the property didn't satisfy the loan, the borrowers would be faced with a huge deficiency judgment. Lenders were also filing multiple legal actions against these borrowers, who lacked legal resources and knowledge to combat them. The single action rule applied to real property loans means that the lender gets one bite at the legal apple in pursuing collection. The anti-deficiency component, when applicable, prevents the lender from pursuing the borrower for collection of any loan losses not covered when the lender forecloses and sells the collateral.
On the other side of the issue, the law does specifically allow for deficiency judgments against guarantors, except in certain circumstances. But it makes the lender decide up front which avenue it will take in pursuing collection.
When a lender decides to foreclose on real property, California's single action law requires a real estate lender to either pursue a non-judicial foreclosure (via notice of default and trustee sale, without requiring judicial procedures, which are costly and time consuming) or judicial foreclosure (requires a lawsuit, plus the lender then has to hold the property for a period of time to allow for borrower's right of redemption). Nonjudicial foreclosure precludes any deficiency against the obligor (person who signed the promissory note as a borrower). If the lender opts for judicial foreclosure, a deficiency can be pursued if filed within three months. No deficiency judgment is allowed if the loan was a purchase money loan on a 1-4 owner occupied residence (or refinance of purchase money loan) or seller financed. More recent changes in the law also preclude deficiency judgments on the shortfall in loan payoff where a lender has agreed to a short sale.
If a party guarantees a loan on real estate, but was really intended to be the primary obligor (sham guarantee), then any waiver they may have signed in giving up their anti-deficiency rights may be invalid. This would mean that the lender would be subject to the anti-deficiency rules above (they are always subject to the single action rule for real estate secured loans).
Common scenarios that might involve a sham guarantee defense by a borrower:
A general partner who guarantees a loan is already liable for the debt of the partnership, and therefore CA courts have found such guarantees to be shams. If you want me to look up some cases you can cite on this point, let me know.
A revocable trust is generally considered to be sort of an alter ego of the trustor, without its own tax id number or true separate entity status. When a settlor (trustor) and the primary beneficiary are the same and the trustor retains the power to revoke the trust, the assets of the trust generally remain subject to claims against the settlor/trustor, and therefore a guarantee under this circumstance would likely be a sham. Even so, there may be circumstances when you want the trustor obligated on the loan directly or guaranteeing if the loan is to the trust.
Using an irrevocable trust or real estate holding entity, even if owned by the same persons who are also personally guaranteeing, is generally not determined by the courts to be a sham, unless the lender forces such a structure- for example, the lender tells Jane Doe that she must form an LLC to be the obligor and that she personally must guarantee the loan.
The test seems to be whether the person you are making guarantor would have already been liable on the loan. If so, then a guarantee will not be valid as a means to reach past the single action rule and antideficiency rule.