
13 Cal.App.3d 290 (1970)
91 Cal. Rptr. 514
JOHN SOUTHFIELD, Plaintiff and Appellant,
v.
F. WAYNE BARRETT, Defendant and Respondent.
Docket No. 10011.
Court of Appeals of California, Fourth District, Division Two.
December 3, 1970.
*291 COUNSEL
John T. Tomlinson, Jr., for Plaintiff and Appellant.
Elliott N. Yearsley for Defendant and Respondent.
*292 OPINION
TAMURA, J.
This action arises out of a contract between plaintiff and defendant wherein plaintiff and one Prothro (not a party to the action or this appeal) agreed to advance $40,000 to defendant and defendant agreed to harvest and deliver to plaintiff hay to be grown on certain described lands. Plaintiff agreed to market the hay and to credit defendant with the proceeds less certain deductions, including commissions. After partial performance defendant refused to make further deliveries.
Plaintiff sued for breach of contract, money had and received, and account stated. As a special defense to the action defendant pleaded that the contract was illegal in that plaintiff was acting as a commission merchant without a license in violation of the applicable provisions of the Agricultural Code. Pursuant to stipulation the issue of illegality was tried by the court prior to the trial of any other issues. The court determined that the contract was illegal and void and entered judgment that plaintiff take nothing by his complaint. Plaintiff appeals from the judgment.
The issue of illegality was submitted on the following stipulated facts.
The parties entered into the contract on January 11, 1967. It provided that plaintiff and Prothro were to furnish defendant $40,000 on or before February 3, 1967; the payment was to constitute "advance payment" on hay crops to be harvested by defendant from certain described lands comprising about 1,120 acres; plaintiff agreed to market the hay without delay at "fair market price[s]"; plaintiff was to deduct $10.50 per ton for commissions and costs of handling and marketing and the balance was to be applied to the repayment of the $40,000 advance plus $2,000 interest. Defendant harvested and delivered his crops pursuant to the contract until April 15, 1967. On that date he ceased making further deliveries. It was stipulated that in entering into the contract plaintiff was acting as a commission merchant and that at all times mentioned in the complaint he was unlicensed.
(1) Plaintiff suggests that the transaction was a "cash purchase" and, hence, not proscribed by the Agricultural Code. The contention is devoid of merit. The agreement was clearly not a contract of sale; it was an agreement to sell the hay for defendant on a commission basis. Such transaction by an unlicensed person was proscribed by statute. Section 1263 of the Agricultural Code, then in effect, provided that "[n]o person shall act as a commission merchant, dealer, broker, cash buyer, or agent" without a license (Stats. 1965, ch. 1287, p. 3169, § 1) and section 1273 provided that any person guilty of so acting without a license was guilty of *293 a misdemeanor subject to fine or imprisonment in the county jail or both (Stats. 1947, ch. 774, p. 1861, § 10).[1]
Although the provisions of the Agricultural Code relating to produce dealers, unlike section 7031 of the Business and Professions Code relating to contractors, do not contain an express provision prohibiting an unlicensed person from suing on a contract for which a license is required, such contracts by unlicensed produce dealers have been declared to be illegal and void. (California Chicks, Inc. v. Viebrock, 254 Cal. App.2d 638, 641 [62 Cal. Rptr. 269]; La Rosa v. Glaze, 18 Cal. App.2d 354, 359 [63 P.2d 1181].) Courts have refused to enforce such contracts or lend assistance to a party who seeks compensation thereunder. (California Chicks, Inc. v. Viebrock, supra.)
(2) As his principal authority for the proposition that illegality is not a defense, plaintiff cites a decision of the Supreme Court which was vacated on rehearing. (Fomco, Incorporated v. Joe Maggio, Inc. (Cal.) 8 Cal. Rptr. 459, 356 P.2d 203.) That case involved a contract wherein defendant agreed to produce and sell carrots to plaintiff. Plaintiff was not a licensed commission merchant. After partial performance defendant refused to make further deliveries under the contract. Plaintiff sued and recovered as damages loss of profits resulting from defendant's breach. In the vacated opinion the Supreme Court unanimously affirmed the judgment holding that the fact plaintiff was not licensed was not a valid defense to the action. One ground of the decision was that the Legislature, by its failure to incorporate in the Agricultural Code a provision similar to section 7031 of the Business and Professions Code, intended to withhold the drastic penalty which would result from holding contracts by unlicensed persons to be unenforcible. An alternate ground for the decision was that both plaintiff and defendant were acting as commission merchants within the meaning of the statute and that, therefore, as between the two, one could not rely upon the other's unlicensed status as a defense. On rehearing the court again unanimously affirmed the judgment but on the narrow ground that the issue of illegality had not been timely raised. (Fomco, Inc. v. Joe Maggio, Inc., 55 Cal.2d 162, 166 [10 Cal. Rptr. 462, 358 P.2d 918].) It had been first raised on defendant's motion for new trial on the ground of newly discovered evidence. The court held there was no showing of reasonable diligence to discover the fact that plaintiff was unlicensed and that the motion for new trial was properly denied. Thus, the final decision in Fomco did not consider the issue of illegality on its merits and does not aid plaintiff. Moreover, it is noted that although the dissent in *294 California Chicks, Inc. v. Viebrock (1967) supra, 254 Cal. App.2d 638 relied on substantially the same grounds set forth in the vacated decision of the Supreme Court in Fomco, supra, the Supreme Court denied a hearing.
(3a) Despite the illegality of the contract, plaintiff should not be denied relief. (4) The rule requiring courts to withhold relief under the terms of an illegal contract is based on the rationale that the public importance of discouraging such prohibited transactions outweighs equitable considerations of possible injustice as between the parties. (Griffis v. Squire, 267 Cal. App.2d 461, 470-471 [73 Cal. Rptr. 154].) (3b) However, the rule is not an inflexible one to be applied in its fullest rigor under any and all circumstances. A wide range of exceptions has been recognized. (Tri-Q, Inc. v. Sta-Hi Corp., 63 Cal.2d 199, 218-219 [45 Cal. Rptr. 878, 404 P.2d 486]; Emmons, Williams, Mires & Leech v. State Bar, 6 Cal. App.3d 565 [86 Cal. Rptr. 367].) Where the public cannot be protected because the transaction has already been completed, no serious moral turpitude is involved, defendant is the one guilty of the "greatest moral fault," and defendant would be unjustly enriched at the expense of plaintiff if the rule were applied, the general rule should not be applied. (Tri-Q, Inc. v. Sta-Hi Corp., supra.) In such circumstances, equitable solutions have been fashioned to avoid unjust enrichment to a defendant and a disproportionately harsh penalty upon the plaintiff. (Griffis v. Squire, supra, 267 Cal. App.2d 461, 472-473; Haney v. Narigon, 247 Cal. App.2d 528, 531-532 [55 Cal. Rptr. 638].)
The present case is one in which plaintiff should be entitled to some relief. The violation of law was one which did not involve serious moral turpitude; the policy of protecting the public from the future consequences of the contract will not be furthered because the transaction has been completed; neither party can be said to have been guilty of the "greatest moral fault;" defendant would be unjustly enriched at the expense of plaintiff were he not required at least to repay the balance owing on the $40,000 advance payment; and the penalty resulting from denial of relief would be disproportionately harsh in relation to the violation involved.[2]
We conclude that notwithstanding illegality of the contract plaintiff should be entitled to recover the balance due on the $40,000 advance payment together with the agreed interest of $2,000. The balance should be determined by crediting defendant with the market value of the hay *295 delivered pursuant to the contract less out-of-pocket expenses actually incurred by plaintiff in handling and marketing the same, but with no allowance for commissions.
Judgment is reversed with directions to the trial court to take further proceedings in the matter not inconsistent with the views here expressed.
Gardner, P.J., and Kerrigan, J., concurred.
A petition for a rehearing was denied December 28, 1970, and respondent's petition for a hearing by the Supreme Court was denied January 28, 1971.
NOTES
[1]  The Agricultural Code was amended in 1967. However, the sections referred to above have been reenacted in substantially the same form.
[2]  Although the stipulated facts did not disclose the balance owing on the advance, plaintiff asserts in his brief that the sum is in the neighborhood of $20,000. That assertion is not refuted by defendant.
