
91 Wis.2d 119 (1979)
280 N.W.2d 765
GENERAL SPLIT CORPORATION, Plaintiff-Respondent,
v.
P & V ATLAS CORPORATION, Defendant-Appellant.
No. 76-544.
Supreme Court of Wisconsin.
Submitted on briefs May 31, 1979.
Decided June 29, 1979.
*121 For the appellant the cause was submitted on the briefs of William H. Alverson, Peter M. Sommerhauser, Richard S. Marcus and Godfrey & Kahn, S.C., of Milwaukee.
For the respondent the cause was submitted on the brief of Richard L. Olson, William A. Abbott and Boardman, Suhr, Curry & Field of Madison.
WILLIAM G. CALLOW, J.
The circuit court denied a motion by the defendant P & V Atlas Corporation, a real estate leasing company, to dismiss an amended complaint for failure to state a claim upon which relief can be granted. We affirm.
The plaintiff General Split Corporation, a leather producer, leased the premises of its principal offices from Atlas under successive, written leases beginning April 1, 1955. One of the terms of the leases provided that the defendant furnish the plaintiff its required utility services, including electricity, water, gas, and steam. Plaintiff was to pay the defendant "all charges" for the utilities as measured by the defendant's meters. The complaint alleges that the defendant based its electrical charges on readings from three, and later four, meters. The plaintiff claims that, if the defendant had based the charges upon single meter service, the electricity charges would have been less since the charges per kilowatt-hour decreased as power use increased.
The plaintiff alleges that the defendant was unjustly enriched by the difference between the amounts it paid *122 and the amounts it would have paid if there were single meter service. The complaint states that the defendant knew of the "benefit" of the difference between charges based on the four meters and a charge based on a single meter but that the plaintiff did not know of such a benefit. The complaint alleges that amounts charged were unconscionably high and contrary to public policy as evidenced by a 1963 Public Service Commission order authorizing a Wisconsin Electric Power Company rule that customers who "submeter" and resell electricity
"... shall charge rates which are not higher than the currently filed rates of the company for comparable service to the ultimate user. The rates shall be supplied on the basis of single meter service or as such service would be metered by the company."
The complaint states that Wisconsin Electric would have charged on the basis of a single meter. The complaint alleges, finally, that the charges violated the terms of the lease. The plaintiff seeks damages of $387,000 plus interest.
The defendant moved to dismiss the complaint for failure to state a claim on which relief can be granted. Sec. (Rule) 802.06(2), Stats. The trial court denied the motion, determining that the complaint stated a claim for breach of contract "based on excessive charges under the lease." The defendant appeals.
The appeal presents the question: Does the complaint state a claim on which relief can be granted?
[1-6]
We have recently considered the question and said:
"For the purpose of testing whether a claim has been stated pursuant to a motion to dismiss under sec. 802.06 (2) (f), Stats., the facts pleaded must be taken as admitted. Anderson v. Continental Insurance Co., 85 Wis.2d 675, 683, 271 N.W.2d 368 (1978). The purpose of the complaint is to give notice of the nature of the claim; and, therefore, it is not necessary for the plaintiff to set out in the complaint all the facts which must eventually *123 be proved to recover. Id. at 683-84. The purpose of a motion to dismiss for failure to state a claim is the same as the purpose of the old demurrerto test the legal sufficiency of the claim. Hartridge v. State Farm Mutual Automobile Ins. Co., 86 Wis.2d 1, 4-5, 271 N.W.2d 598 (1978); Anderson, supra at 683. Because the pleadings are to be liberally construed, a claim should be dismissed as legally insufficient only if `it is quite clear that under no conditions can the plaintiff recover.' Clausen and Lowe, The New Wisconsin Rules of Civil Procedure, Chapters 801-803, 59 Marq. L. Rev. 1, 54 (1976). The facts pleaded and all reasonable inferences from the pleadings must be taken as true, but legal conclusions and unreasonable inferences need not be accepted. Hartridge, supra at 4-5.
"Sec. 802.06(2) (f), Stats., on which the motions to dismiss were based, is similar to Rule 12(b) (6) of the Federal Rules of Civil Procedure. A claim should not be dismissed under the Wisconsin rule or the federal rule unless it appears to a certainty that no relief can be granted under any set of facts that plaintiff can prove in support of his allegations. See, Wright and Miller, 5 Federal Practice and Procedure, sec. 1215, p. 113; Conley v. Gibson, 355 U.S. 41, 47-8 (1957)."
Morgan v. Pennsylvania General Insurance Co., 87 Wis.2d 723, 731-32, 275 N.W.2d 660 (1979). See also: Wilson v. Continental Insurance Cos., 87 Wis.2d 310, 316-18, 274 N.W.2d 679 (1979).
[7]
In Val-Lo-Will Farms v. I. Azoff & Asso., 71 Wis.2d 642, 238 N.W.2d 738 (1976), we said "[o]n demurrer ... the question which must be answered by the court is whether any cause of action has been stated upon which relief can be granted. A plaintiff is bound by the facts he alleges, not by his theory of recovery."
The essential allegations of this complaint are:
"8. That money in the amount of the difference between the rates charged by defendant since service began up to the present, and the rates which defendant would have charged plaintiff had it based its charge *124 upon single meter service was and is wrongfully appropriated and possessed by defendant in the amount of approximately $1,500 per month.
"9. That the defendant has had knowledge of the existence of the benefit of such difference conferred upon it since the beginning of provision of service to plaintiff, and that plaintiff has not had such knowledge.
"10. That the retention of money in the amount of such difference is unjust enrichment of defendant in that the amounts charged were and are unconscionably high, and in that:
"1) Defendant at all times herein mentioned charged unjust and unreasonably high rates in contravention of Wisconsin law and public policy, and after twenty days following the date of the above-mentioned order, in contravention of a lawful order of the Public Service Commission of Wisconsin, which, although not binding on defendant in itself, serves as evidence of the unfairness and injustice of plaintiff's charges, and as an indication of the general law and public policy of the State of Wisconsin; and
2) At all times herein mentioned, defendant charged and collected monies from plaintiff for electrical service which were and are in excess of the amounts required to be paid by the aforementioned lease (s) between the parties, in that said lease explicitly segregates utility charges from rent charges at paragraph 4(c), and said charge was and is unreasonably high and unjust."
[8-10]
The law implies a promise of repayment (when no rule of public policy and good morals has been violated) of a benefit conferred by one upon another when it would be inequitable to allow retention of the benefit. Hicks v. Milwaukee County, 71 Wis.2d 401, 404, 238 N.W.2d 509 (1975). An action to recover such a benefit is one for money had and received and is based on a theory of quasi-contract. It is governed by equitable principles. Id.
[11,12]
Defendant contends that it had no legal duty to charge the plaintiff lower rates and, therefore, that there was no overpayment or "benefit" conferred on the defendant. *125 If the payments were in excess of those required by the contract, the plaintiff might, however, be entitled to restitution. Cf.: George J. Meyer Manufacturing Co. v. Howard Brass & Copper Co., 246 Wis. 558, 18 N.W.2d 468 (1945). Paragraph 10(2) of the complaint alleges that the amounts charged were in excess of the amounts required to be paid under the lease. The lease is alleged to have obligated the plaintiff to pay "all charges" for utilities as measured by the defendant's meters. The crucial issue is whether this provision required the plaintiff to pay only the charges it would pay the utility for the same service or whether it contemplated a sum to be set by the defendant. Considering the complaint alone, the issue cannot be resolved; the allegation itself does not foreclose the plaintiff from establishing that the contract required the defendant to charge only what the utility would charge. The contract must be read as a whole; and if the terms at issue are ambiguous, extrinsic evidence may be considered in construing the language. RTE Corp. v. Maryland Casualty Co., 74 Wis.2d 614, 620-21, 247 N.W.2d 171 (1976). We conclude the motion to dismiss was properly overruled.
[13]
The complaint further alleges that the rates were illegal and against public policy. Coupled with the allegation that the plaintiff did not know of the difference between the rates, there is a claim for restitution stated since a party not in pari delicto may have restitution of benefits conferred under an illegal contract. Restatement of Contracts, sec. 604 (1932); Restatement of Restitution, sec. 107(1) (1937). See also: Dobbs, Remedies, sec. 13.5 at 997 (Hornbook Series, 1973); Wade, Restitution of Benefits Acquired Through Illegal Transactions, 95 U. Pa. L. Rev. 261 (1947). Whether the contract is illegal because it is opposed to public policy is an issue which can only be resolved after full consideration of the facts.
By the Court.Order affirmed.
