There has a been a recent flurry of cases in California courts awarding homeowners disgorgement of all fees paid to general contractors (under B&P Section 7031). In cases like White v. Cridlebaugh, 175 Cal. App. 4th 1535 – 2009 and Oceguera v. Cohen, there were technical defects with the general contractor's license–ie, the general contractor had been licensed at one time, but failed to adhere to the guidelines or insurance to remain licensed. In the case of Wright v. Isaak, the general contractor had lost his license due to willful underreporting of his employees and failure to maintain worker's compensation insurance for the employees (while billing the unsuspecting homeowner for labor!).
In the recent case of Alatriste v. Cesar's Exterior Designs, Inc., the case actually addressed the issue of the homeowner actually knowing that the general is unlicensed. The court concluded that the statute is very clear–it didn't matter that the homeowner knew that the general was unlicensed, the general contractor still had to disgorge all payments (including costs) of the job.
It strikes me that in previous case law, there was discussion of the legislative intent to protect consumers from unlicensed contractors, and that before even evaluating whether the contractor could make a showing of unjust enrichment the courts would evaluate whether the general was licensed at the time of negotiating the contract with the homeowners. The obvious reasoning being the homeowner should not be misled by the general's licensed status at the time of contracting. However, if the homeowner knows the contractor is not licensed in California, negotiates a lower price as a result, getting "handyman" rates, then should the homeowner retain the right to then seek disgorgement when the relationship goes south? Seems inequitable, and perhaps an unintended gap in the legislation.