793 P.2d 855

#### HYDRO CONDUIT CORPORATION, Plaintiff-Appellant, v. Robert KEMBLE, as Secretary, New Mexico Public Safety Department, Technical and Emergency Support Division; Taos County Commissioners: Julian Romero, John Gaillour, Jr., and Telesfor Gonzales; Socorro County Commissioners: Charles A. Zimmerly, John Gallagher and Charles B. Padilla, Defendants-Appellees.

No. 18446.

Supreme Court of New Mexico.

June 19, 1990.

*174Rodey, Dickason, Sloan, Akin & Robb, P.A., David C. Davenport, Jr., Santa Fe, Baker & Hostetler, John N. McNamara, Jr., Marjorie N. Sloan, Denver, Colo., for plaintiff-appellant.

Hal Stratton, Atty. Gen., Bruce Charles, Barbara Vigil, Asst. Attys. Gen., Santa Fe, for defendant-appellee Kemble.

John P. Viebranz, Socorro, for defendantappellee Socorro County Com’rs.

Sammy Pacheco, Dist. Atty., Taos, for defendant-appellee Taos County Com’rs.

OPINION

MONTGOMERY, Justice.

The issue in this case is whether sovereign immunity bars a claim against the state for unjust enrichment. The trial court held that it does and granted the state’s motion to dismiss the complaint for failure to state a claim upon which relief could be granted. We hold that the trial court was correct and affirm: A claim for unjust enrichment is an action “based on contract” within the grant of immunity to governmental entities under NMSA 1978, Section 37-1-23.

I.

During 1984, the State of New Mexico, through the Office of Military Affairs/Civil Emergency Preparedness Division (the State), entered into a series of contracts for certain public works projects with CRW Development Corporation (CRW) as the general contractor. These projects consisted, either entirely or largely, of disaster relief programs carried out in Taos and Socorro Counties. The plaintiff in this case, Hydro Conduit Corporation (Hydro Conduit), supplied materials, including corrugated pipe, culverts and related supplies, which were incorporated into the projects. As things turned out, CRW and certain state officials were participants in a scheme to defraud the State; the State was overcharged on various aspects of the projects, and CRW — even though it was paid by the State — failed to pay its materials subcontractor, Hydro Conduit, for the value of the materials supplied. The State, however, did recover some of the funds disbursed to CRW from two insurance companies that carried fidelity bonds on the state officials who were ultimately convicted of dishonest and possibly other wrongful conduct.

Hydro Conduit’s avenue for recovery, however, was apparently limited to the possibility of this action against the State because CRW was defunct and its principal stockholder and officer, Richard Rowand, was insolvent. Although Hydro Conduit sought recovery in the action below against the insurance companies on their fidelity bonds, those claims were dismissed. Because of the collusion between CRW and the state officials, there were no performance or payment bonds under New Mexico’s “Little Miller Act,” NMSA 1978, Sections 13-4-18 to -20 (Repl.Pamp.1988); and of course a mechanic’s or materialman’s lien cannot be filed against the state. State ex rel. W.M. Carroll & Co. v. K.L. House Constr. Co., 99 N.M. 186, 187-88, 656 P.2d 236, 237-38 (1982). Hydro Conduit thus brought this action against the State and the county commissioners of Taos and Socorro Counties. Its complaint alleged simply that the State was presently enjoying the use and benefit of the materials without payment to Hydro Conduit and that the State’s retention of those materials without payment would constitute unjust enrichment. Similar allegations were asserted against the county commissioners.

The State and the county commissioners moved to dismiss the complaint for failure to state a claim upon which relief could be granted, on the ground that Section 37-1-23 barred Hydro Conduit’s claims. Alternatively, the defendants’ motions sought summary judgment, on the ground that they had paid substantially in full for all materials and that, therefore, they would not be “unjustly” enriched by retaining those materials. The district court granted the motion to dismiss, ruling that the action was barred by the statute; it did not reach the alternative motion (for summary judgment) challenging the availability of a claim for • unjust enrichment under the *175claimed fact that the State and the counties had fully paid for the materials.

On appeal, Hydro Conduit attacks only the district court’s ruling as to the applicability of the sovereign-immunity statute. It argues that a claim for unjust enrichment is not a claim “based on contract” and hence that the statute does not prevent assertion of such a claim against the State or other governmental entities. In response, the State defends the district court’s legal ruling that a claim for unjust enrichment is a claim “based on contract.” The State also supports the ruling on the alternative ground that a claim for unjust enrichment will not lie on these facts.

As noted above, we affirm the lower court’s ruling as to the applicability of the statutory grant of immunity, for essentially the reason that the court gave. In this opinion we discuss preliminarily the viability of Hydro Conduit’s unjust enrichment claim apart from the statutory bar, but we do not uphold the district court’s dismissal on the alternative ground advanced by the State. As Hydro Conduit argues, the district court did not address the summary judgment aspect of the State’s motion, and consideration of that motion requires resort to factual matters that Hydro Conduit was precluded from exploring by the district court’s dismissal of the complaint. At the same time, the unjust-enrichment setting in which Hydro Conduit asserts its claims provides a useful perspective from which to view the primary issue in this case — the applicability of Section 37-1-23.

We turn first, then, to a brief discussion of unjust enrichment as a basis for restitution to a supplier of goods or services in a construction project when the owner receives the benefit of those goods or services but the supplier receives no payment for them.

II.

Citing State v. Fireman’s Fund Indemnity Co., 67 N.M. 360, 355 P.2d 291 (1960), and United States ex rel. Sunworks Division of Sun Collector Corp. v. Insurance Co. of North America, 695 F.2d 455 (10th Cir.1982), Hydro Conduit first asserts that New Mexico recognizes a claim for restitution, in an action based for example on quasi-contract, as distinct from a claim based on an actual contract, express or implied but resting on the mutual assent of the parties. In the Sunworks case, the Tenth Circuit said:

> One who has been unjustly enriched at the expense of another may be required by law to make restitution. Restatement of Restitution § 1 comments a, b, c (1937). This quasi-contractual obligation is created by the courts for reasons of justice and equity, notwithstanding the lack of any contractual relationship between the parties. New Mexico law recognizes such a cause of action. In fact, in Terry v. Pipkin, 66 N.M. 4, 340 P.2d 840 (1959), New Mexico specifically acknowledged that a subcontractor who has lost his mechanic’s lien claim against a property owner may have a claim in quantum meruit where the owner has not paid the general contractor.

695 F.2d at 458 (citations and footnote omitted).

Despite the statement in Sunworks that a subcontractor can maintain a claim in quantum meruit against the property owner in certain circumstances, the general rule seems to be to the contrary. See generally Annotation, Building and Construction Contracts: Right of Subcontractor Who Has Dealt Only with Primary Contractor to Recover Against Property Owner in Quasi Contract, 62 A.L.R.3d 288 (1975). Sunworks itself allowed the claim to be asserted against the general contractor, not the property owner. In Terry v. Pipkin, the plaintiff, allowed to pursue a quantum meruit claim against a property owner, stood in privity of contract with the latter; the Court held that where the contract did not encompass compensation for the materials furnished by the plaintiff, the plaintiff could sue for such compensation in quantum meruit. Since Terry v. Pipkin, this Court in George M. Morris Construction Co. v. Four Seasons Motor Inn, Inc., 90 N.M. 654, 567 P.2d 965 (1977), reversing a judgment in favor of a subcontractor, held that “the laws of New *176Mexico do not give a subcontractor a personal cause of action against owners, only a lien against the land or structure. Most jurisdictions have rejected such quasi-contractual claims against owners, although two states have allowed such actions in narrow circumstances.” 90 N.M. at 656-57, 567 P.2d at 967-68 (citation omitted); see also 2 G. Palmer, The Law of Restitution § 10.7(b) at 423 (1978):

> [Where] a subcontractor seeks restitution from a landowner whose property has been improved by the subcontractor’s performance[,] [t]he subcontractor’s contract right is against the general (or prime) contractor, but if that remedy is inadequate, as it will be when the prime contractor is insolvent, restitution frequently is sought from the landowner, but nearly always denied.

Whatever may be the law generally as to the availability of a claim for restitution in favor of a subcontractor against a property owner when the two lack a contractual relationship, it is clear that a claim for unjust enrichment cannot be maintained against the property owner when he has already paid (usually, the general contractor) for the services performed or materials supplied by the subcontractor. In Sun-works the general contractor (who was the defendant and against whom the claim was allowed) had utilized the plaintiff’s materials in completing the project, had received payment from the Government, and had not paid anyone for the materials. The court was careful to qualify its recognition of the subcontractor’s quantum meruit claim as existing “where the owner has not paid the general contractor.” 695 F.2d at 458. According to the A.L.R. annotation cited above,

> the most commonly cited [consideration invoked by courts against recovery by the subcontractor] has been the fact — in cases where it was such a fact — that the landowner had already paid to the general contractor all, or a very substantial part, of the amount due the latter under the terms of the primary agreement between them, and that to allow the subcontractor to recover from the landowner would therefore be to require him to pay twice.

62 A.L.R.3d at 295. See also 2 G. Palmer, supra, § 10.7(b) at 424: “If [the landowner] has paid the general contractor for the work he is not enriched, and clearly restitution in favor of the subcontractor should be denied.”

Following this line of reasoning, we would be inclined to doubt that a claim for unjust enrichment would lie against the State in any event, because, under the facts asserted by the State in support of its motion for summary judgment, the State paid CRW for the materials supplied by Hydro Conduit, and thus there was no unjust enrichment of the State resulting from Hydro Conduit’s performance of its subcontract. Hydro Conduit responds to this argument by pointing out that an opportunity to litigate the facts is precisely what it desired and what the district court precluded by dismissing the complaint. It also responds that the State would not be required to pay twice if the claim were allowed, because the State has been compensated for its losses by the proceeds from the fidelity bonds. To allow the State to have the benefit of the materials, says Hydro Conduit, and also to retain the bond proceeds, which at least to some extent have compensated the State for the wrongful acts of its employees, does indeed result in unjust enrichment to the State at Hydro Conduit’s expense.

Were it not for the bar of sovereign immunity, we might be inclined to allow Hydro Conduit’s claim to go forward and await the development of a more complete factual record as to the extent of the State’s compensation, the sources of that compensation, and the effect of that compensation on the State’s having to “pay twice.” Since the trial court did not rule on these questions, however, we leave for another day the interesting issues as to (1) whether a property owner can ever be liable to a subcontractor for unjust enrichment; (2) whether and to what extent payment by the property owner to the general (or another) contractor for the services or materials furnished by the subcontractor *177will bar the latter’s claim for unjust enrichment; and (3) whether, if the property owner receives compensation from a collateral source, the subcontractor may pursue a claim for unjust enrichment. We turn instead to the issue on which the lower court rested its dismissal of the complaint: whether a claim for unjust enrichment is “based on contract” and thus, absent a valid written contract, barred by Section 37-1-23.

III.

In Hicks v. State, 88 N.M. 588, 544 P.2d 1153 (1975), this Court abolished the common-law doctrine of sovereign immunity. On rehearing, the Court held that the decision would apply only prospectively to (tort) claims accruing on and after July 1, 1976. 88 N.M. at 593, 544 P.2d at 1158. The legislature was in session in early 1976, and it thereupon enacted N.M.Laws 1976, Chapter 58 (2d Session), most of which became effective July 1, 1976. Sections 1-19 of Chapter 58 make up the Tort Claims Act, now codified as NMSA 1978, Sections 41-4-1 to -29 (Repl.Pamp.1989). Section 24 of Chapter 58, enacted what is now NMSA 1978, Section 37-1-23, which reads:

CONTRACTUAL LIABILITY — STATUTE OF LIMITATIONS.—

> A. Governmental entities are granted immunity from actions based on contract, ■ except actions based on a valid written contract.

> B. Every claim permitted by this section shall be forever barred unless brought within two years from the time of accrual.

The title of Chapter 58 reads in part as follows: “An Act Relating to the Liability of Government in the State of New Mexico; Granting Sovereign Immunity to the State, Local Public Bodies and Their Employees; Making Certain Exceptions to That Immunity; * * N.M.Laws 1976, ch. 58 (2d Session), at 159. Section 24 repealed a then existing section of the 1953 Compilation, NMSA 1953, Section 22-23-1 (Supp. 1975), reading: “Actions not otherwise provided by law may be maintained and any judgment enforced against the state and any of its agencies when based on a written contract.” The title of the act which established this section was: “An Act Relinquishing the Sovereign Immunity of the State in Actions Based on Written Contracts.” N.M.Laws 1963, ch. 152.

From this bit of legislative history we believe that the purpose of Chapter 58 of the 1976 session laws was to reinstate the sovereign immunity which had been abolished by Hicks v. State, subject to certain exceptions.1 The principal exception, of course, was the limited liability placed on the state for its torts, recovery for which could now be sought under the Tort Claims Act. Another exception was the acceptance of liability for claims based on valid written contracts. A governmental entity’s liability under this exception, however, depends on the existence of a valid written contract, and it is undisputed that Hydro Conduit has no such contract with the State or the counties.

Hydro Conduit forcefully argues, however, citing Methola v. County of Eddy, 95 N.M. 329, 622 P.2d 234 (1980), that statutes in derogation of the common law are strictly construed and that since the “common law” now recognizes no sovereign immunity,2 the statute here (Section 37-1-23) *178grants such immunity to governmental entities only when a claim is “based on contract.” The claim here, the argument runs, is not based on contract, because liability for unjust enrichment is fundamentally different from liability grounded in either tort or contract; unjust enrichment provides a third, analytically distinct basis for liability, and a claim resting on this ground falls outside the statutory grant of immunity to claims “based on contract.”

We have no disagreement with the scholarly view that restitution for unjust enrichment constitutes an independent basis for recovery in a civil-law action, analytically and historically distinct from the other two principal grounds for such liability, contract and tort. See 1 G. Palmer, The Law of Restitution § 1.1 at 1-2 (1978) (footnotes omitted):

> It has been traditional to regard tort and contract as the two principal sources of civil liability at common law * * *. There is another category that must be separated from all of these; this is liability based in unjust enrichment. In particularized form this has been a part of our law from an early time, but it has been slow to emerge as a general theory. In present American law, however, the idea of unjust enrichment has been generally accepted and widely applied.

> Restitution based upon unjust enrichment cuts across many branches of the law, including contract, tort, and fiduciary relationship, but it also occupies much territory that is its sole preserve.

See also Restatement of the Law of Restitution § 1 (1937) (tort, contract and restitution are the three primary areas in the overall classification of the law); Comment, Restitution: Concept and Terms, 19 Hastings L.J. 1167, 1170 (1968) (the law should be given a tripartite classification of tort, contract and restitution); Corbin, Quasi-Contractual Obligations, 21 Yale L.J. 533 (1912) (jurists have long recognized- obligations that do not fall within the classes of tort or contract).

At the same time, the question before us is, what did the legislature intend by granting immunity to governmental entities for liability “based on contract”? We might assume that some legislators had an awareness of the scholarly division and tripartite classification of the law into tort, contract, and restitution categories; we can also assume with equal or greater confidence that others did not. No doubt some legislators, if they read the bill and thought about the problem, assumed that, as discussed below, actions “based on contract” included actions based on quasi-contracts or based on contracts “implied in law.” As we view the question before us, however, it is not whether there was a specific intention on the part of the legislature to grant immunity to governmental entities for claims based on unjust enrichment; the question rather is whether the basic purpose of the statute to reinstitute sovereign immunity extends to claims of the sort asserted here —i.e., a claim for restitution on the ground that the state will be unjustly enriched if restitution is not ordered.

This type of claim carries many labels, some of which may be analytically or theoretically distinct from others, but all of them having common root, at least historically, in the concept of an action sounding in contract. See Note, supra, 19 Hastings L.J. at 1167-68 (1968) (one form of restitution, fashioned by English common-law courts, indebitatus assumpsit, came to mirror contract causes of action). We have recognized that an action in quantum meruit is different from an action on an alleged contract, but the case in which this difference was acknowledged illustrates how closely the two concepts are related. In State v. Fireman’s Fund Indemnity Co., 67 N.M., 360, 364, 355 P.2d 291, 294 (1960), we quoted from Restatement of the Law of Contracts § 5 comment (a) (1932), as follows:

> *179Contracts are often spoken of as express or implied. The distinction involves, however, no difference in legal effect, but lies merely in the mode of manifesting assent. Implied contracts must be distinguished from quasi-contracts, which also have often been called implied contracts, or contracts implied in law. Quasi-contracts, unlike true contracts, are not based on the apparent intention of the parties to. undertake the performances in question, nor are they promises. They are obligations created by law for reasons of justice. Such obligations were ordinarily enforced at common law in the same form of action (assumpsit) that was appropriate to true contract, and some confusion with reference to the nature of quasi-contracts has been caused thereby.

See also Albuquerque Nat’l Bank v. Albuquerque Ranch Estates, Inc., 99 N.M. 95, 102, 654 P.2d 548, 555 (1982) (availability of equity to prevent unjust enrichment); Allsup v. Space, 69 N.M. 353, 362, 367 P.2d 531, 537 (1961) (equitable nature of claim for restitution based on unjust enrichment). As stated by the Supreme Court of Tennessee in a case allowing a claim for unjust enrichment to proceed against an owner of property benefited by a contractor who supplied labor and materials for its improvement:

> Actions brought upon theories of unjust enrichment, quasi contract, contract implied in law, and quantum meruit are essentially the same. Courts frequently employ the various terminology interchangeably to describe that class of implied obligations where, on the basis of justice and equity, the law will impose a contractual relationship between parties, regardless of their assent thereto.

Paschall’s, Inc. v. Dozier, 219 Tenn. 45, 53-54, 407 S.W.2d 150, 154 (1966) (emphasis added).

From all of this we conclude that, even though an action for unjust enrichment is not “based on contract” in a strict theoretical sense, it is so closely related to an action which is so based that the immunity statute here, Section 37-1-23, should be construed to extend immunity to an unjust enrichment claim as well as to a claim founded on a true, but unwritten, contract.3 In so construing our statute, we refer once again to its purpose, which we have found was to reinstate sovereign immunity as to this type of claim. See Tijerina v. Baker, 78 N.M. 770, 775, 438 P.2d 514, 519 (1968) (statutes should be construed according to purpose for which enacted); Pittsburgh & Midway Coal Min. Co. v. Revenue Div., 99 N.M. 545, 559, 660 P.2d 1027, 1041 (Ct.App.), cert. quashed, 99 N.M. 644, 662 P.2d 645 (1983) (court’s duty is to find interpretation most harmonious with statutory scheme and general purpose manifested by legislature).

Our conclusion that the statute here should be construed to bar a claim against the State in unjust enrichment is buttressed by decisions from other states, in which, admittedly, the distinction between “implied in law” contracts (i.e., relationships giving rise to a claim for unjust enrichment) and “implied in fact” contracts (i.e., true contracts, based on parties’ mutual assent as manifested by their conduct) is not always carefully observed. See, e.g., Mass Transit Admin. v. Granite Constr. Co., 57 Md.App. 766, 471 A.2d 1121 (1984); Morgenroth & Assocs., Inc. v. Town of Tilton, 121 N.H. 511, 431 A.2d 770 (1981); Madrid Lumber Co. v. Boone County, 255 Iowa 380, 121 N.W.2d 523 (1963). In each of these cases the claim for unjust enrichment was barred on sovereign immunity grounds. The policy served by such a refusal to permit liability is to protect the public purse and to require that parties seeking recovery from the state for benefits conferred on it have “valid written contracts,” which presumably will have been carefully negotiated under procedures like those set out in our Procurement Code, NMSA 1978, Sections 13-1-28 to -199 (Repl.Pamp.1988 & Supp.1989). In most cases the party furnishing goods or services is protected by statutes like the Little *180Miller Act, which permits suits against the state as well as the general contractor and its bonding companies. See State ex rel. Electric Supply Co. v. Kitchens Constr., Inc., 106 N.M. 753, 755, 750 P.2d 114, 116 (1988) (Little Miller Act was enacted to protect suppliers of materials under any subcontract involving state 'construction project). Where no such relief is available, as in the instant case, the legislature has decreed that the risk of loss must fall, perhaps as a cost of doing business, on the contractor or subcontractor who undertakes performance of a contract on a state project, rather than on the taxpayers who presumably have already paid all or most of the costs of the project.

The district court correctly dismissed Hydro Conduit’s complaint, and its order is affirmed.

IT IS SO ORDERED.

SOSA, C.J., and RANSOM, J., concur.

1

. Three years later, the legislature made certain that sovereign immunity would extend to actions involving a claim of title to or interest in real property by enacting N.M.Laws 1979, ch. 110 (codified as NMSA 1978, Section 42-11-1 (Cum.Supp.1989)), which grants immunity to the state, its political subdivisions and any branches, agencies, departments, boards, commissions, instrumentalities and institutions, except as specifically authorized by law.

2

. Exactly what the "common law” was after Hicks is not clear. In Ferguson v. New Mexico State Highway Commission, 99 N.M. 194, 656 P.2d 244 (Ct.App.1982), cert. denied, 99 N.M. 226, 656 P.2d 889 (1983), our court of appeals held that the Tort Claims Act was not unconstitutional because the legislature had the power to modify Hicks v. State and partially reinstate sovereign immunity. “The legislature acted well within its authority in abrogating the common law to the extent provided for in the Act. It substituted statutory partial immunity for *178common law total immunity and the court’s denial of any immunity." Id. at 195, 656 P.2d at 245. The "common law" partially abrogated by the legislature was clearly the common law existing before Hicks. But the common law now recognizes a constitutionally valid statutory imposition of sovereign immunity, and such immunity must be honored by the courts where the legislature has so mandated.

3

. For a case in which an implied-in-fact contract action against the state was held barred by Section 37-1-23, see Trujillo v. Gonzales, 106 N.M. 620, 747 P.2d 915 (1987).