242 F.3d 1055 (Fed. Cir. 2001)
BARRETT REFINING CORPORATION, Plaintiff-Appellee,v.UNITED STATES, Defendant-Appellant.
No. 00-5036
UNITED STATES COURT OF APPEALS FOR THE FEDERAL CIRCUIT
March 13, 2001

[Copyrighted Material Omitted]
James D. Bachman, Doyle & Bachman LLP, of Arlington, Virginia, argued for plaintiff-appellee. With him on the brief was Scott W. Woehr.
Sheryl L. Floyd, Senior Trial Counsel, Commercial Litigation Branch, Civil Division, Department of Justice, of Washington, DC, argued for defendant-appellant. With her on the brief was David M. Cohen, Director. Of counsel on the brief was Karen Schools, Defense Energy Support Center, Defense Logistics Agency, Ft. Belvoir, Virginia.
Before MICHEL, RADER, and LINN, Circuit Judges.
LINN, Circuit Judge.


1
The United States ("government") seeks review of a final decision of the Court of Federal Claims awarding Barrett Refining Corp. ("Barrett") the fair market value of the goods it delivered under one contract and dismissing the United States' counterclaims for amounts that the United States paid in excess of fair market value on three other contracts. Barrett Refining Corp. v. United States, 45 Fed. Cl. 166 (1999) ("Barrett 2"). We affirm the Court of Federal Claims'    grant of quantum valebant relief to Barrett, but vacate its dismissal of the government's counterclaims and remand for further consideration.

BACKGROUND

2
The facts central to this appeal are discussed below. For additional background, all the facts of this case are explained in great detail in two thorough and well-written opinions from the Court of Federal Claims. Id.; Barrett Refining Corp. v. United States, 42 Fed. Cl. 128 (1998) ("Barrett 1").


3
Barrett entered into four contracts with the Defense Fuel Supply Center, now called the Defense Energy Support Center, that are relevant to the present appeal. Barrett 1, 42 Fed. Cl. at 129 n.2. All four contracts were for the delivery of military jet fuel. Each contract contained a base price and the government's then-standard price adjustment clause. Barrett qualified as a small disadvantaged business ("SDB") that, in accordance with an elaborate system of SDB preference factors, affected the base price of these contracts. Id. at 129, 134.


4
In a separate and earlier action, the government's standard price adjustment clause was held to be unenforceable because it failed to comply with the Federal Acquisition Regulations. MAPCO Alaska Petroleum, Inc. v. United States, 27 Fed. Cl. 405, 408, 416 (1992). As a result, Barrett filed suit in the Court of Federal Claims seeking damages after both parties had fully performed the contracts. In its first decision, the Court of Federal Claims determined that only the price adjustment clause was invalid and that Barrett had a claim under quantum valebant entitling it to receive at least fair market value for each of the four contracts. Barrett 1, 42 Fed. Cl. at 134. The Court of Federal Claims then directed the parties to develop, jointly if possible, a fair market valuation. Id. at 138.


5
The parties did not agree on a valuation. Barrett 2, 45 Fed. Cl. at 167. Therefore, in its second decision, the Court of Federal Claims determined an appropriate methodology. Id. at 169-74. Using that methodology, the court found that Barrett had received fair market value on all but one of the contracts, and it awarded Barrett the difference between the fair market value and the payment received on that single contract. Id. at 174. The court also dismissed, for failure to state a claim, the government's counterclaims that the amounts that the government paid in excess of fair market value on the other three contracts should either: (1) be refunded to the government; or (2) be used to offset Barrett's award. Id.


6
The government appeals to this court, asserting error in the valuation methodology and the dismissal of its counterclaims. We have exclusive appellate jurisdiction. 28 U.S.C.  1295(a)(3) (1994).

DISCUSSION
A. Standard of Review

7
This court reviews legal conclusions from the Court of Federal Claims de novo, and reviews factual findings for clear error. Alger v. United States, 741 F.2d 391, 393 (Fed. Cir. 1984). The Supreme Court has stated that "[a] finding is 'clearly erroneous' when although there is evidence to support it, the reviewing court on the entire evidence is left with the definite and firm conviction that a mistake has been committed." United States v. United States Gypsum Co., 333 U.S. 364, 395, 92 L. Ed. 746, 68 S. Ct. 525 (1948).


8
This court reviews discretionary decisions from the Court of Federal Claims, such as the selection    of a method of determining fair market value, for an abuse of discretion. Seravalli v. United States, 845 F.2d 1571, 1575 (Fed. Cir. 1988) (stating, in an appeal from the United States Claims Court, that "[trial] courts necessarily must have considerable discretion to select the method of valuation that is most appropriate in the light of the facts of the particular case"). In reviewing another Court of Federal Claims decision, this court has stated that "an abuse of discretion is found when: (1) the court's decision is clearly unreasonable, arbitrary or fanciful; (2) the decision is based on an erroneous construction of the law; (3) the trial court's factual findings are clearly erroneous; or (4) the record contains no evidence upon which the district court rationally could have based its decision." Air Land Forwarders, Inc. v. United States, 172 F.3d 1338, 1341 (Fed. Cir. 1999).

B. Analysis
1. Barrett's Quantum Valebant Claim

9
a.


10
The government first raises the threshold question of whether the Court of Federal Claims had jurisdiction to consider Barrett's claim for quantum valebant relief.1 The government suggests that Barrett's    claim relies on an implied-in-law contract and correctly points out that the Court of Federal Claims has no jurisdiction over such contracts. However, the court does have jurisdiction over implied-in-fact contracts. United States v. Mitchell, 463 U.S. 206, 218, 77 L. Ed. 2d 580, 103 S. Ct. 2961 (1983) (stating that the Tucker Act "does not reach claims based on contracts implied in law, as opposed to those implied in fact"); City of Cincinnati v. United States, 153 F.3d 1375, 1377 (Fed. Cir. 1998). Therefore, the Court of Federal Claims had jurisdiction because the quantum valebant relief was based on an implied-in-fact contract. See Northrop Grumman Corp. v. United States, 47 Fed. Cl. 20, 40-41 (2000) (analyzing whether there was an implied-in-fact contract meriting quantum valebant relief).


11
In the present case, the Court of Federal Claims found that "once the unauthorized [price escalation] clause is struck out, . . . [the] express contract simply incorporates an implied-in-fact promise by the government to pay at least fair market value for the fuel delivered by Barrett under the contract." Barrett 2, 45 Fed. Cl. at 170. We find no basis to conclude that the Court of Federal Claims clearly erred in treating Barrett's claim as being premised on an implied-in-fact contract and agree that the court properly exercised jurisdiction over Barrett's claim.


12
The government is, at least implicitly, also challenging the court's finding of an implied-in-fact contract. That question, to which we now turn, goes not to jurisdiction, but to whether Barrett has stated a claim upon which relief can be granted. City of Cincinnati, 153 F.3d at 1377.


13
The Supreme Court has defined an implied-in-fact contract as "an agreement . . . founded upon a meeting of minds, which, although not embodied in an express contract, is inferred, as a fact, from conduct of the parties showing, in the light of the surrounding circumstances, their tacit understanding."    Balt. & Ohio R.R. v. United States, 261 U.S. 592, 597, 67 L. Ed. 816, 43 S. Ct. 425 (1923); Cities Serv. Gas Co. v. United States, 205 Ct. Cl. 16, 500 F.2d 448, 451-52 (Ct. Cl. 1974) (quoting Baltimore & Ohio); Trauma Serv. Group v. United States, 104 F.3d 1321, 1326 (Fed. Cir. 1997); City of Cincinnati, 153 F.3d at 1377.


14
Given that the price escalation clause was unauthorized and unenforceable,2 we agree with the Court of Federal Claims' implicit legal conclusion that there was no longer any express clause covering price escalation, and thus, nothing to preclude an implied-in-fact agreement on that term. We also agree with the Court of Federal Claims' factual finding of a promise by the government to pay at least fair market value. Barrett 2, 45 Fed. Cl. at 170. Indeed the government concedes in its opening brief that the parties "would have agreed upon a clause providing for the payment of the market price." Accordingly, we find no reason to conclude that the Court of Federal Claims' factual findings regarding the parties' intent to provide for fair market-value consideration of pricing is    clearly erroneous.


15
This court has previously identified four requirements of an implied-in-fact contract: (1) mutuality of intent to contract;    (2) consideration; (3) lack of ambiguity in offer and acceptance; and (4) actual authority in the government representative to bind the government. City of Cincinnati, 153 F.3d at 1377. The first three requirements are clearly met in light of the court's finding, which we have upheld, that the government intended to pay at least fair market value, and in light of the undisputed performance of the contract by both parties. Regarding the fourth requirement, there can be no dispute, and the parties raise none, that the government agent had the authority to bind the government to a contract paying at least fair market value. Thus, we agree with the Court of Federal Claims' legal conclusion that there was an implied-in-fact promise to pay fair market value and, thus, an implied-in-fact contract. It follows that Barrett has stated a claim upon which relief could be granted.


16
b.


17
We now address the merits of the Court of Federal Claims' decision to provide Barrett quantum valebant relief based on the implied-in-fact contract. The government presents three challenges. First, the government asserts that the Court of Federal Claims did not provide quantum valebant relief,    but rather reformed the contract, or at least utilized a "reformation approach." Second, the government objects to the failure to utilize a comparable sales approach to determine fair market value. Third, the government objects to the selection of a naphtha-based index instead of a gasoline-based index as the basis of the price escalation. We treat these in turn.


18
The government's first challenge, that the court reformed the contract or used a reformation approach, is without merit. The Court of Federal Claims clearly explained that it was providing quantum valebant relief and clearly utilized a quantum valebant approach. The government emphasizes, however, that in determining fair market value the court: (1) replaced the price index of the unauthorized price escalation clause with an alternate price index; and (2) used the word "reformation" on a single occasion in its opinion to refer to this replacement. Barrett 2, 45 Fed. Cl. at 171. Such a replacement, and the colloquial reference to it as a reformation, does not, however, convert the court's entire exercise of determining a proper fair market valuation into contract reformation. The court is given the    task of determining a fair market valuation and its choice is accorded discretion. Seravalli, 845 F.2d at 1575. We discern no abuse of that discretion in the court's decision to fashion a valuation that resembled the parties' own agreement. Indeed, in another case involving the government's failure to provide fair compensation, one of this court's predecessor courts stated that "no better answer to [the question of what is fair compensation] can be given than what the parties agreed upon." Pac. Mar. Ass'n v. United States, 123 Ct. Cl. 667, 108 F. Supp. 603, 607 (Ct. Cl. 1952); see also Urban Data, 699 F.2d at 1155-56 (citing Pacific Maritime with approval).


19
The government's second challenge, that the Court of Federal Claims erred in not using a comparable sales method, is also without merit. This court has stated that the comparable sales method is not mandated and that this court is "unwilling to restrict the trial courts to any single basis for determining fair market value." Seravalli, 845 F.2d at 1575. The government urges that our general statements in Seravalli should not apply to the present case    because Seravalli involved real estate and not jet fuel. However, we find the statements in Seravalli to be entirely consistent with the concept of affording a trial court discretion. The government has not shown, and we do not discern, any abuse of discretion in the court's decision not to use a comparable sales method.


20
The government's third challenge, that the selection of a naphtha-based index was error because it did not preserve the bargain of the parties as much as the selection of a gasoline-based index would have, also fails. The government's argument is based on the fact that the unauthorized escalation clause called for the use of a gasoline-based index. However, the government does not dispute the Court of Federal Claims' finding that the naphtha-based index "provides data that more closely reflects the product Barrett was actually selling." Barrett 2, 45 Fed. Cl. at 170. The government also argues that a naphtha-based index is inappropriate because there is no nationwide naphtha market. Although the government may desire that a standard clause use an index that is based on a product with a national market (gasoline, and not naphtha), that consideration    is irrelevant for determining whether Barrett received fair market value for the fuel it delivered. The government has not persuaded us that the Court of Federal Claims abused its discretion by basing its valuation on the products actually delivered by Barrett.

2. The Government's Counterclaims

21
a.


22
The government argues that the court erred by not analyzing all four contracts at issue in the same manner. The government correctly notes that it paid more than the fair market value, as determined by the court, for three of the four contracts at issue. Arguing from this, the government asserts that it has a claim for these differentials or, in the alternative, that they should be used to offset the deficiency in the fourth contract.


23
In its reply brief, the government appears to recognize that it has no claim under the theory of quantum valebant. That doctrine is an equitable one for the recovery of the value of goods or services provided. Urban Data, 699 F.2d at 1154; United States v. Amdahl Corp., 786 F.2d 387, 392 (Fed. Cir. 1986); see also AT&T, 177 F.3d at 1384 (Plager, J., dissenting-in-part and concurring-in-part); Black's    Law Dictionary 1243-44 (6th ed. 1990). Accordingly, only the provider of the goods or services has such a claim. See Urban Data, 699 F.2d at 1154 (explaining that the contractor "is entitled to reimbursement on a quantum valebant basis for the reasonable value in the market place of the supplies and concomitant services" (underlining added)); Amdahl, 786 F.2d at 392 (stating that the goods provider "is entitled to recover on a quantum valebant basis for the reasonable value in the market place of the use that respondent has so far made of the equipment" (underlining added)). Therefore, if the government is to recover, or offset, any money from the other three contracts, it needs to find another theory of recovery.


24
The only other theory offered by the government is its authority to recover unauthorized payments.3 The government's payments were at least partially unauthorized. The unauthorized portion presumably being the entire amount of the price escalation(s), because it was this amount that was calculated according to an illegal method. MAPCO, 27 Fed. Cl. at 408, 416. The government does, of course, recognize Barrett's    claim for fair market value. Accordingly, no award to the government could be so large that it reduced Barrett's recovery below fair market value.


25
The government cites numerous cases for the proposition that it can recover unauthorized payments. E.g., Wisc. Cent. R.R. Co. v. United States, 164 U.S. 190, 210, 212, 41 L. Ed. 399, 17 S. Ct. 45 (1896). Such a claim relies on equitable principles, and is presumably based on an implied-in-law contract theory. See Royal Indemnity Co. v. United States, 313 U.S. 289, 296, 85 L. Ed. 1361, 61 S. Ct. 995 (1941)    (stating that equitable rules relate to "recovery on quasi contractual obligations arising from payment of money by mistake"); Wisc. Cent., 164 U.S. at 212 ("parties receiving moneys illegally paid by a public officer are liable ex aequo et bono to refund them" (underlining added)); Sanborn v. United States, 135 U.S. 271, 281, 34 L. Ed. 112, 10 S. Ct. 812 (1890) (stating that the contractual payment made by the government was based on mistake and misrepresentation and that amount "ought, in equity and good conscience, to be returned to the United States"); City of Cincinnati, 153 F.3d at 1377 (stating that implied-in-law contracts "impose duties that are deemed to arise by operation of law," whereas implied-in-fact contracts require that "the parties' conduct indicates mutual assent"); see also Mo. Utilities Co. v. City of California, Mo., 8 F. Supp. 454, 468 (W.D. Mo. 1934) (stating that "[a] suit by the United States to recover money illegally paid by some government official is an action upon the implied contract of the recipient to pay it back" and that "an action for money had and received, although a law    action, is governed by equitable principles"); Black's Law Dictionary 557 (6th ed. 1990) (defining ex aequo et bono as: "in justice and fairness; according to what is just and good; according to equity and conscience"). The government concedes as much, identifying the basis of its claim as the equitable theory of ex aequo et bono and stating that it arises in this case because of a mistake of law.


26
As explained earlier, the Court of Federal Claims' Tucker Act jurisdiction does not extend to claims based on an implied-in-law contract. However, 28 U.S.C.  1503 and 2508 provide the court with jurisdiction if the government brings such a claim as a counterclaim. 28 U.S.C.  1503, 2508 (1994); Cont'l Mgmt., Inc. v. United States, 527 F.2d 613, 616 n.2 (Ct. Cl. 1975) (stating that under  1503 "the Government may set up a counterclaim even though . . . it states a claim of a type (e.g. tort) of which [the Court of Claims] would not have jurisdiction if sought to be maintained by a plaintiff") (citing Cherry Cotton Mills, Inc. v. United States, 327 U.S. 536, 90 L. Ed. 835, 66 S. Ct. 729 (1946)); Cherry Cotton Mills, 327 U.S. at 539 (stating that the purpose of the predecessor to  1503 "was to permit the government, when sued in the Court of Claims, to have determined in a single suit all questions which involved mutual obligations between the government and a claimant against it"); Daff v. United States, 78 F.3d 1566, 1570 & n.5 (Fed. Cir. 1996) (allowing the government to counterclaim under  1503 and 2508 for unliquidated progress payments); see also BLH, Inc. v. United States, 13 Cl. Ct. 265, 275 (1987) ("Although [the Claims Court] does not generally have jurisdiction over implied-in-law contracts, an exception exists for counterclaims for money damages asserted by the government." (citing  1503 and Cherry Cotton Mills) (internal citation omitted)). Thus, the Court of Federal Claims did have jurisdiction to hear the government's counterclaims.


27
b.


28
We turn now to whether those counterclaims stated a claim upon which relief could be granted. The Court of Federal Claims determined that the cases cited by the government, for the proposition that it could recover unauthorized payments, were all factually distinguishable.    We, however, are of the opinion that even if the relevant cases can be distinguished, those distinctions do not circumvent the fact in this case that part of the government's payments were unauthorized.


29
The relevant cases stand for the proposition that the government can recover unauthorized payments. United States v. Wurts, 303 U.S. 414, 415, 82 L. Ed. 932, 58 S. Ct. 637 (1938) ("The Government . . . can recover funds which its agents have wrongfully, erroneously, or illegally paid."); Wisc. Cent., 164 U.S. at 210 ("As a general rule, and on grounds of public policy, the government cannot be bound by the action of its officers, who must be held to the performance of their duties within the strict limits of their legal authority, where, by misconstruction of the law under which they have assumed to act, unauthorized payments are made."); Fansteel Metallurgical Corp. v. United States, 145 Ct. Cl. 496, 172 F. Supp. 268, 270 (Ct. Cl. 1959) ("It seems clear that no officer or agent of the Government is clothed with authority to disburse money belonging in the public treasury without authority so to do. Nor can an officer or agent act    beyond the limits of his authority. . . . When a payment is erroneously or illegally made it is in direct violation of . . . the Constitution.").


30
The Court of Federal Claims determined, and Barrett argues, that the facts of this case are distinguishable from all of the cases articulating the above proposition. Indeed, in the present case the government is attempting, through its counterclaims, to recover amounts that it was obligated to pay under a contract that has not been declared void. However, Grand Trunk Western Railway Co. v. United States, 252 U.S. 112, 64 L. Ed. 484, 40 S. Ct. 309 (1920), contains analogous facts. In that case, the government recovered unauthorized payments made for the transportation of mail. Id. Despite contracts covering the price term, the government recovered payments that were in excess of a statutory maximum rate. Id. at 121, 124. Although it is not clear what the price terms in the contracts in Grand Trunk specified, there is no indication that the government felt it had paid more than the contractual amount. Id. at 121. The only significant distinction from the present case is that Grand    Trunk involved a statute specifying the maximum rate, rather than a regulation only authorizing certain methods of computing the price.


31
Although these distinctions may be compelling in another case, they are not compelling in the present one. This is because they do not undermine the rationale for allowing the government to recover unauthorized payments. As the Supreme Court stated in Wisconsin Central:


32
The question is not presented as between the government and its officer, or between the officer and the recipient of such payments, but as between the government and the recipient, and is then a question whether the latter can be allowed to retain the fruits of action not authorized by law, resulting from an erroneous conclusion by the agent of the government as to the legal effect of the particular statutory law under or in reference to which he is proceeding.


33
164 U.S. at 210. Barrett's arguments, discussed below, present no compelling argument, equitable or otherwise, for allowing it "to retain the fruits of action not authorized by law." Id.


34
Barrett's brief presents five arguments in support of the Court of Federal Claims' dismissal of the government's counterclaims. These are: (1) the government's payments were not overpayments because, first, they were in the amount called for by the contract and, second, the illegality was in the method of computing the payments, not in the amounts that were paid; (2) only the price escalation clause was illegal and unenforceable, not the entire contract; (3) Barrett made no implied promise to pay back the unauthorized payments; (4) the government is not entitled to quantum valebant equitable relief; and (5) the government is prohibited by Federal Circuit case law from benefiting from its own illegal clause.


35
Given our analysis of the controlling cases above, the first two arguments have no merit. The third argument is irrelevant because it cannot remove the lack of authorization. We also take note, as did the Supreme Court in Wisconsin Central, "of the principle that parties receiving moneys illegally paid by a public officer are liable ex aequo et bono to refund them." 164 U.S. at 212. Regarding Barrett's fourth argument, we noted earlier that the government is not seeking quantum valebant relief.


36
Barrett's last argument hinges on a statement that this    court made in Beta Systems, Inc. v. United States, 838 F.2d 1179 (Fed. Cir. 1988). In Beta Systems, the government had, similarly, insisted on using a price escalation clause that was found to be inconsistent with a relevant regulation, and the contractor had acquiesced. Id. at 1185. Considering the equities in that case, the Beta Systems court concluded that if the clause "violated the [law], the government can not, by law, benefit from it." Id. However, in Beta Systems the government based its price escalation clause on an index that failed to track the cost of the principal construction material of the contract. Id. This failure violated the relevant regulations and resulted in the government paying less than what was contemplated by the parties and the law. See id. at 1185-86. Thus, in contrast with the present case, Beta Systems did not involve any unauthorized payments. Further, in the present case the government is not trying to enforce the illegal clause, as it was in Beta Systems.


37
In sum, the government has stated a claim upon which relief can be granted. Moreover, the evidence shows that the    payments made by the government were based on an illegal price escalation clause and, thus, were unauthorized. As a consequence, and in the absence of any compelling equitable arguments to the contrary, the government has a right to seek and recover the unauthorized payments it made. See Wurts, 303 U.S. at 415; Wisc. Cent., 164 U.S. at 210; Fansteel, 172 F. Supp. at 270.


38
Accordingly, we vacate the Court of Federal Claims' dismissal of the government's counterclaims and remand for further consideration consistent with this opinion. On remand the court must determine the amount of the payments made under the unauthorized price escalation clause and order Barrett to refund that to the government, subject to Barrett's claim for fair market value. In that process, the court should make findings regarding the base price that the government agreed to in each of the contracts in question. If the base price exceeded the fair market value, then the Court of Federal Claims should only order Barrett to refund payments made in excess of the base price.

CONCLUSION

39
We have found no error in the decision of the Court of Federal Claims to award    Barrett quantum valebant relief. However, the government's counterclaims have stated a claim upon which relief could be granted and the Court of Federal Claims erred in dismissing them.


40
AFFIRMED-IN-PART, VACATED-IN-PART, AND REMANDED



Notes:


1
 This court has previously noted the difference between quantum meruit and quantum valebant. "The former is said to apply to services and the latter to goods." Urban Data Sys., Inc. v. United States, 699 F.2d 1147, 1154 n.8 (Fed. Cir. 1983); see also Black's Law Dictionary 1243-44 (6th ed. 1990). As in Urban Data, "the difference is of no significance here." Urban Data, 699 F.2d at 1154 n.8.


2
 The determination in MAPCO that only the price escalation term was unenforceable and invalid, and that the entire contract was not invalid, is consistent with our case law. Urban Data, 699 F.2d at 1148, 1154 (affirming "the Board's decision that the subcontracts had invalid price terms" and stating that it was "plain that only the price terms of the two subcontracts were invalid--not any other part of those agreements"); AT&T v. United States, 177 F.3d 1368, 1376 (Fed. Cir. 1999) (en banc) (stating that the Urban Data "court held that a contract price term that was contrary to law did not invalidate the fully performed contract"). But see Urban Data, 699 F.2d at 1150, 1156 (stating that the Board opinion "determined that both subcontracts were void ab initio" and later "affirming the opinion of the [Board]").


3
 The government also states this theory as the recovery of overpayments. It asserts that it overpaid Barrett in the amount that its cumulative payments on any given contract exceeded the fair market value, as determined by the Court of Federal Claims, of the fuel delivered. We disagree with this characterization; the government was not limited under any provision of the contract to paying fair market value for the fuel delivered.


