
86 Cal.Rptr.2d 614 (1999)
979 P.2d 974
20 Cal.4th 1103
SCOTT CO. OF CALIFORNIA, Plaintiff and Appellant,
v.
BLOUNT, INC., Defendant and Appellant.
No. S057126.
Supreme Court of California.
July 19, 1999.
Rehearing Denied September 15, 1999.
*615 Mclnerney & Dillon, Timothy F. Winchester and Jewell J. Hargleroad, Oakland, for Plaintiff and Appellant.
Morgenstein & Jubelirer, Eliot S. Jubelirer, Rocky N. Unruh, Jeffrey R. Williams, Lewis D. Barr and Stephen M. Hankins, San Francisco, for Defendant and Appellant.
KENNARD, J.
A party's entitlement to attorney fees in a lawsuit based on a contract containing an attorney fees provision often depends not just upon the language of the contractual provision but also upon the complex interaction of several statutes that affect a party's contractual right to attorney fees, as this case illustrates.
Here, plaintiff sued defendant for contract and tort claims; the contract included *616 a unilateral attorney fees provision permitting defendant to recover its attorney fees if it sued to enforce the contract or to recover damages for its breach, but not authorizing plaintiff to recover its fees. Section 1717 of the Civil Code, however, which governs enforcement of contractual attorney fees provisions, provides that any contractual attorney fees provision must be applied mutually and equally to all parties to the contract, even if it is written otherwise.
Defendant made a pretrial settlement offer that plaintiff rejected. At trial, plaintiff received a money judgment in its favor, but for less than defendant's offer. Under Code of Civil Procedure section 998 as it existed at the time of trial in this case, if a defendant in a civil action makes a pretrial settlement offer that the plaintiff rejects and thereafter the plaintiff does not obtain a more favorable judgment, "the plaintiff shall not recover his or her costs and shall pay the defendant's costs from the time of the offer." Under Code of Civil Procedure sections 1032 and 1033.5, costs include attorney fees if authorized by contract.
From these facts and statutes, two issues arise concerning the parties' entitlement to attorney fees and other costs: May plaintiff recover its preoffer attorney fees and other costs under the contractual attorney fees provision and Civil Code section 1717 as the prevailing party, or does Code of Civil Procedure section 998 cut off plaintiffs right to fees and other costs to which it would otherwise be entitled? May defendant recover its postoffer attorney fees, either under the cost-shifting provision of Code of Civil Procedure section 998 or as a prevailing party under Civil Code section 1717? We conclude, as did the trial court, that plaintiff is entitled to its preoffer attorney fees and other costs, and that defendant is entitled to its postoffer attorney fees.

I
Defendant Blount, Inc., was the general contractor for construction of the San Jose Convention Center. Defendant entered into a subcontract with plaintiff Scott Co. of California for plaintiff to perform mechanical work on the project. The subcontract between plaintiff and defendant contained an attorney fees provision.
Plaintiff subcontractor sued defendant and others, claiming that their actions had caused it to incur large cost overruns in performing its work on the project. As relevant here, plaintiff alleged that defendant, by its poor management of the project, had breached the contract and had been negligent. After resolving its causes of action against the others, plaintiff received a bench trial on its remaining causes of action against defendant. Plaintiff sought damages of over $2 million.
Before trial, however, defendant offered to settle for $900,000; plaintiff rejected this offer and made its own settlement offer of $1.5 million.
In its decision after trial, the trial court found that defendant's "management of the project as the general contractor was at times inadequate, constituting negligence and in breach of its implied contractual obligation to [plaintiff] of good faith and fair dealing...." After disallowing many of plaintiffs items of alleged damage, the trial court awarded plaintiff $442,054 in damages.
After trial, plaintiff and defendant both sought awards of costs and attorney fees. Plaintiff sought its costs, including attorney fees, for the entire lawsuit as the prevailing party in the lawsuit, relying on the contractual attorney fees provision, Civil Code section 1717, and Code of Civil Procedure section 1032; defendant sought under Code of Civil Procedure section 998 its attorney fees and other costs incurred after the time of its offer to plaintiff on the ground that plaintiffs recovery was less than defendant's offer. The trial court ruled that under section 998 plaintiff was entitled to only its preoffer costs, including attorney fees, which totaled $226,812.
*617 With respect to defendant, the trial court held that it was entitled to its postoffer costs, including attorney fees. The trial court awarded defendant its postoffer attorney fees and other costs in the amount of $633,983.60 (of which $568,925 were attorney fees); the trial court also awarded defendant its expert witness fees of $247,652, for a total award to defendant of $881,635.60, an amount greater than the total damages, attorney fees, and other costs awarded to plaintiff.
On appeal, the Court of Appeal agreed with the trial court that plaintiff was entitled to its preoffer attorney fees and other costs but disagreed that defendant was entitled to its postoffer attorney fees.
We granted defendant's petition for review to decide whether plaintiff was entitled to its preoffer attorney fees and other costs and whether defendant was entitled to its postoffer attorney fees.

II
The trial court awarded plaintiff its preoffer attorney fees, finding them authorized by the combined operation of the contractual attorney fees provision, Civil Code section 1717 (hereafter section 1717), and Code of Civil Procedure section 998; it also awarded plaintiff its other preoffer costs, finding them authorized by section 998. The Court of Appeal affirmed this award.
In analyzing the correctness of this award, we shall proceed step by step, first examining Code of Civil Procedure section 1032 (hereafter section 1032), the general cost award statute. Next, we consider the attorney fees provision of the contract, then the effect of section 1717 on the attorney fees provision, and finally the effect of Code of Civil Procedure section 998 as it existed at the time of trial in this case in 1994 (Stats.1987, ch. 1080, § 8, p. 3655, hereafter section 998), especially subdivision (c).
Section 1032 is the fundamental authority for awarding costs in civil actions. It establishes the general rule that "[e]xcept as otherwise expressly provided by statute, a prevailing party is entitled as a matter of right to recover costs in any action or proceeding." (§ 1032, subd. (b).) For purposes of section 1032, a party with a net monetary recovery, like plaintiff here, is a "`[p]revailing party.'" (§ 1032, subd. (a)(4).)
Section 1033.5 of the Code of Civil Procedure (hereafter section 1033.5) specifies the "items ... allowable as costs under Section 1032." It lists as one category of costs "[a]ttorney fees, when authorized by... [¶] (A) Contract," (§ 1033.5, subd. (a)(10)(A).)
The attorney fees provision in the contract between defendant and plaintiff provides: "Should Sub-Contractor [plaintiff] default in any of the provisions of this subcontract and should Contractor [defendant] employ an attorney to enforce any provision hereof, or to collect damages for breach of the subcontract, ... Sub-Contractor and his surety agree to pay Contractor such reasonable attorney's fees as he may expend therein."
On its face, the attorney fees provision is unilateral, giving only defendant and not plaintiff a right to attorney fees. Section 1717, however, renders the provision mutual, giving either plaintiff or defendant, if a prevailing party, a right to attorney fees on any claims based on the contract. It provides: "In any action on a contract, where the contract specifically provides that attorney's fees and costs, which are incurred to enforce that contract, shall be awarded either to one of the parties or to the prevailing party, then the party who is determined to be the party prevailing on the contract, whether he or she is the party specified in the contract or not, shall be entitled to reasonable attorney's fees in addition to other costs. [¶] ... [¶] Reasonable attorney's fees shall be fixed by the court, and shall be an element of the costs of suit." (§ 1717, subd. (a).)
*618 When a party obtains a simple, unqualified victory by completely prevailing on or defeating all contract claims in the action and the contract contains a provision for attorney fees, section 1717 entitles the successful party to recover reasonable attorney fees incurred in prosecution or defense of those claims. (Hsu v. Abbara (1995) 9 Cal.4th 863, 877, 39 Cal. Rptr.2d 824, 891 P.2d 804.) If neither party achieves a complete victory on all the contract claims, it is within the discretion of the trial court to determine which party prevailed on the contract or whether, on balance, neither party prevailed sufficiently to justify an award of attorney fees. "[I]n deciding whether there is a `party prevailing on the contract,' the trial court is to compare the relief awarded on the contract claim or claims with the parties' demands on those same claims and their litigation objectives as disclosed by the pleadings, trial briefs, opening statements, and similar sources." (Id. at p. 876, 39 Cal.Rptr.2d 824, 891 P.2d 804.)
At trial in this case, plaintiff sought to prove more than $2 million in damages; it succeeded in establishing only about $440,000 in damages. Although plaintiff here did not achieve all of its litigation objectives, and thus is not automatically a party prevailing on the contract for purposes of section 1717, the trial court did not abuse its discretion in implicitly concluding that on balance plaintiff prevailed on the contract for purposes of section 1717. Thus, plaintiff ordinarily would be entitled to recover its attorney fees, in addition to its other costs, by virtue of the combined operation of the contractual attorney fees provision, section 1717, section 1032, and section 1033.5. Defendant contends, however, that section 998 cuts off plaintiffs right to its preoffer attorney fees as part of its costs.
Section 998, as it existed in 1994 at the time of trial in this case, provided in relevant part: "(a) The costs allowed under Sections 1031 and 1032 shall be withheld or augmented as provided in this section. [¶] ... [¶] (c) If an offer made by a defendant is not accepted and the plaintiff fails to obtain a more favorable judgment, the plaintiff shall not recover his or her costs and shall pay the defendant's costs from the time of the offer. In addition, in any action or proceeding other than an eminent domain action, the court, in its discretion, may require the plaintiff to pay the defendant's costs from the date of filing of the complaint and a reasonable sum to cover costs of the services of expert witnesses, who are not regular employees of any party, actually incurred and reasonably necessary in either, or both, the preparation or trial of the case by the defendant." (Stats.1987, ch. 1080, § 8, p. 3655.) It is undisputed that the judgment received by plaintiff here was less favorable than defendant's offer for purposes of section 998.
To conclude that section 998 cuts off plaintiffs right to its preoffer costs, including preoffer attorney fees, we would have to overrule a century of authority recognizing this right. In 1890, this court addressed a plaintiffs right to preoffer costs under the predecessor statute to section 998, Code of Civil Procedure former section 997, which similarly provided that "if the plaintiff fail to obtain a more favorable judgment, he cannot recover costs, but must pay the defendant's costs from the time of the offer." (Douthitt v. Finch (1890) 84 Cal. 214, 215, 24 P. 929.) Relying on New York authority interpreting a similar New York statutory provision, we held that the section permitted a prevailing plaintiff who did not obtain a judgment exceeding the defendant's offer to recover its preoffer costs. (Id. at p. 215, 24 P. 929.) California courts have consistently followed this rule since then. (See, e.g., Stiles v. Estate of Ryan (1985) 173 Cal. App.3d 1057, 219 Cal.Rptr. 647.)
In its brief, defendant contends that this interpretation of section 998 is grammatically unsound. It argues that in the portion of section 998 reading "the plaintiff shall not recover his or her costs and shall *619 pay the defendant's costs from the time of the offer," the phrase "from the time of the offer" modifies only "defendant's costs" and not also the phrase "plaintiff shall not recover his or her costs." (§ 998, subd. (c).)
This contention is not persuasive. First, between the time of Douthitt v. Finch, supra, 84 Cal. 214, 24 P. 929, and the time of trial in this case, the Legislature reenacted the settlement cost-shifting statute as section 998 and amended it several times. The phrase used in section 998 at the time of this case"the plaintiff shall not recover his or her costs and shall pay the defendant's costs from the time of the offer"does not differ in substance from the statutory language at issue in Douthitt v. Finch. We presume, in the absence of any contrary indication, that the Legislature was aware of our long-standing interpretation of that phrase beginning with Douthitt and, by retaining its substance, implicitly accepted our interpretation. (See People v. Ledesma (1997) 16 Cal.4th 90, 100-101, 65 Cal.Rptr.2d 610, 939 P.2d 1310.) Second, defendant's interpretation is not the only grammatically plausible one. As plaintiff notes, it is possible to read the concluding phrase "from the time of the offer" in section 998 as modifying the repeated word "costs" in both "defendant's costs" and "plaintiff shall not recover his or her costs." Third, in 1997 the Legislature amended section 998 to expressly provide that a prevailing plaintiff who does not obtain a judgment exceeding defendant's pretrial offer "shall not recover his or her postoffer costs."[1] (Stats. 1997, ch. 892, § 1, italics added.) In doing so, it made clear that section 998 cuts off only a prevailing plaintiffs right to postoffer costs, and not the plaintiffs right to preoffer costs. In the Legislature's view, this amendment confirmed, but did not change, existing law, for the legislative history describes the 1997 amendment as "codify[ing] case law providing that the otherwise prevailing plaintiff shall not receive postoffer costs but may still recover preoffer costs." (Sen. Com. on Judiciary, Analysis of Sen. Bill No. 73 (1997-1998 Reg. Sess.) as amended May 1, 1997, p. 3.)
The long-standing interpretation of section 998 as permitting a plaintiff to recover its preoffer costs regardless of whether it obtains a judgment exceeding the defendant's offer, the Legislature's previous acquiescence in that interpretation, and its recent reaffirmation of that interpretation in its 1997 amendment to section 998, lead us to this conclusion: A plaintiff who rejects a settlement offer that is greater than the recovery it ultimately obtains *620 may nonetheless recover its preoffer costs to which it would otherwise be entitled, including preoffer attorney fees in cases like this one where attorney fees are an authorized category of recoverable costs under sections 1032 and 1033.5.

III
The second question presented in this case is whether defendant may recover its postoffer attorney fees. The trial court held that defendant could recover its postoffer fees for two independent reasons: First, by operation of section 998, a defendant whose settlement offer exceeds the plaintiffs recovery is entitled to postoffer attorney fees in any case in which, as here, attorney fees are otherwise available as costs. Second, under Civil Code section 1717 and the contractual attorney fees provision, defendant had "`prevailed,' for purposes of award of post-offer attorney fees," by holding plaintiff to a damages judgment less than defendant's offer. The Court of Appeal rejected both reasons, holding that section 998 shifts to the plaintiff only the defendant's entitlement to costs other than attorney fees and that defendant was not a prevailing party under section 1717. Because we conclude for the reasons stated below that defendant was entitled to its postoffer attorney fees as part of its postoffer costs under section 998, we do not address the trial court's alternative holding that defendant was a prevailing party under section 1717 for purposes of postoffer costs.
As noted previously, section 1032 establishes this general rule: "Except as otherwise expressly provided by statute, a prevailing party is entitled as a matter of right to recover costs in any action or proceeding." (§ 1032, subd. (b).) Section 998 modifies the general rule of section 1032 that only the prevailing party recovers its costs. It begins by stating: "The costs allowed under Sections 1031 and 1032 shall be withheld or augmented as provided in this section." (§ 998, subd. (a).) Section 998 further provides that where, as here, the plaintiff recovers a judgment less than defendant's pretrial offer, the defendant may recover its costs notwithstanding that the plaintiff is the prevailing party: "the plaintiff ... shall pay the defendant's costs from the time of the offer." (§ 998, subd. (c).) Thus, under section 998 a defendant whose pretrial offer is greater than the judgment received by the plaintiff is treated for purposes of postoffer costs as if it were the prevailing party.
But what costs? The postoffer costs that section 998 denies to the plaintiff and awards to the defendant whose offer exceeds the judgment for plaintiff are "[t]he costs allowed under Section[ ] ... 1032" (§ 998, subd. (a)) to a prevailing party. In turn, as discussed previously, section 1033.5 specifies the "items ... allowable as costs under Section 1032." The costs specified by section 1033.5 include attorney fees "when authorized by ... [¶] (A) Contract." (§ 1033.5, subd. (a)(10)(A).) The contract here authorizes attorney fees. Therefore, in this case defendant is entitled under section 998 to those costs incurred after the settlement offer to which a prevailing party would be entitled under section 1032: by operation of section 1033.5, attorney fees are a category of cost allowable under section 1032 to which defendant is entitled.[2]
*621 The Court of Appeal, however, rejected the logic of this reasoning. It held instead that defendant could not recover its postoffer attorney fees for two reasons. First, it held that under the terms of the contract, which provided for attorney fees "should [defendant] employ an attorney to enforce any provision hereof, or to collect damages for breach of the subcontract," defendant could not recover attorney fees because its attorneys had not been used to "enforce" the contract or to collect damages. Second, it held that section 1717 did not authorize defendant to recover postoffer attorney fees because attorney fees are available only to the prevailing party under section 1717 and defendant was not the prevailing party.
The Court of Appeal's first reason is not persuasive. Every contractual attorney fees provision must be read in light of section 1717, and that section forecloses the Court of Appeal's semantic argument that defendant may not recover because it did not incur any attorney fees for the purpose of enforcing the contract or collecting damages. The goal of section 1717 is full mutuality of remedy between parties to a contract, whether plaintiffs or defendants, in the matter of attorney fees. (Hsu v. Abbara, supra, 9 Cal.4th 863, 870, 39 Cal.Rptr.2d 824, 891 P.2d 804.) "To achieve its goal, the statute generally must apply in favor of the party prevailing on a contract claim whenever that party would have been liable under the contract for attorney fees had the other party prevailed." (Id. at pp. 870-871, 39 Cal. Rptr.2d 824, 891 P.2d 804.) Section 1717 does this by providing that when, as here, "the contract specifically provides that attorney's fees and costs, which are incurred to enforce that contract, shall be awarded... then the party who is determined to be the party prevailing on the contract ... shall be entitled to reasonable attorney's fees." (§ 1717, subd. (a), italics added.)
Thus, had defendant here prevailed on the contract by defeating completely plaintiffs contract claims, it would have been entitled to attorney fees under the contractual provision by virtue of section 1717. The Court of Appeal accordingly erred when it stated of the contractual fee provision here: "It does not, as [defendant] represented below, grant attorney's fees to the prevailing party in any action between [defendant] and [plaintiff]." To the contrary, under section 1717 that is precisely the effect of a contractual provision like the one here authorizing attorney fees to enforce the contract.
More fundamentally, the Court of Appeal's result ignores the basic structure and purpose of section 998. It is the very essence of section 998 that, to encourage both the making and the acceptance of reasonable settlement offers, a losing defendant whose settlement offer exceeds the judgment is treated for purposes of postoffer costs as if it were the prevailing party. To require a defendant to show that it is a prevailing party in order for it to be entitled under section 998 to any category of costs, as the Court of Appeal did, is to misunderstand section 998. When the defendant seeks costs on the basis of the first sentence of subdivision (c) of section 998, the defendant by definition is not the prevailing party and is not entitled to any category of costs on that basis. Under section 998, the defendant's entitlement to costs derives not from its status as a prevailing party but from the plaintiffs failure to accept a reasonable settlement offer.
There is no sound basis under section 998 for distinguishing attorney fees from other categories of costs, as the Court of Appeal did here. Section 998's language *622 does not limit the categories of costs to be awarded the defendant: "[T]he plaintiff... shall pay the defendant's costs from the time of the offer." (§ 998, subd. (c).) Those costs are "[t]he costs allowed under Section[] ... 1032" to a prevailing party. (§ 998, subd. (a).) Nor does the fact that the losing defendant is not a prevailing party afford a basis for denying it attorney fees while permitting it to recover other categories of costs available to the prevailing party under section 1032. Just as a losing defendant ordinarily has no right to attorney fees under section 1717 because it is not a prevailing party, so too a losing defendant ordinarily has no right to other categories of costs under section 1032 because it is not a prevailing party.
The Court of Appeal's position would introduce an asymmetry into the structure of section 998 that would be contrary to section 998's language and purpose. In addition to not limiting the categories of costs to be awarded the defendant, section 998 does not distinguish between the categories of postoffer costs denied to a prevailing plaintiff and those awarded to a losing defendant whose offer the plaintiff does not beat: "[T]he plaintiff shall not recover his or her costs and shall pay the defendant's costs from the time of the offer." (§ 998, subd. (c).) Just as the plaintiff is denied all those postoffer costs, and receives all those preoffer costs, to which it would otherwise be entitled as a prevailing party, including attorney fees, the defendant may recover all those postoffer costs to which it would have been entitled had it been a prevailing party, including attorney fees.[3] Under the Court of Appeal's holding, however, a plaintiff rejecting a settlement offer in a case in which there is a contractual attorney fees provision would know that, should it prevail with a judgment less than the offer, it would still get its preoffer attorney fees but would not be liable for defendant's postoffer attorney fees. This asymmetry is contrary to the language of section 998 just quoted and would substantially lessen the cost to plaintiffs of rejecting reasonable settlement offers.[4]
Also supporting our conclusion that section 998 should be applied symmetrically and evenhandedly to both plaintiffs and defendants in the circumstances before us is our decision in Bank of San Pedro v. Superior Court (1992) 3 Cal.4th 797, 12 Cal.Rptr.2d 696, 838 P.2d 218. In that case, we considered whether a losing plaintiff appealing from a judgment that included an award of the defendant's expert witness fees under section 998 was required to post an appeal bond; a losing defendant appealing from a judgment including an award of the plaintiffs expert witness fees under section 998 must post such a bond. We held that the plaintiff *623 too was required to post an appeal bond: "Not to require an undertaking [by the plaintiff] in this case would further thwart the policy of section 998 by creating an anomalous disparity between plaintiffs and defendants.... An evenhanded application of the requirement for an undertaking on appeal best effectuates the policy of encouraging settlements under section 998." (3 Cal.4th at pp. 804-805, 12 Cal. Rptr.2d 696, 838 P.2d 218.) So too here.
Finally, awarding a defendant its postoffer attorney fees as well as its other costs accords with the intended function of section 998, which we have previously described as follows: "It is to encourage settlement by providing a strong financial disincentive to a partywhether it be a plaintiff or a defendantwho fails to achieve a better result than that party could have achieved by accepting his or her opponent's settlement offer. (This is the stick. The carrot is that by awarding costs to the putative settler the statute provides a financial incentive to make reasonable settlement offers.)" (Bank of San Pedro v. Superior Court, supra, 3 Cal.4th 797, 804, 12 Cal.Rptr.2d 696, 838 P.2d 218.) It would greatly weaken the "strong financial disincentive" of section 998 to deny a defendant in these circumstances its postoffer attorney fees.[5]

CONCLUSION
We reverse in part the judgment of the Court of Appeal, and remand with instructions to affirm the judgment of the trial court with respect to its award of attorney fees and other costs.
GEORGE, C.J., MOSK, J., BAXTER, J., WERDEGAR, J., CHIN, J., and BROWN, J., concur.
NOTES
[1]  The relevant language of subdivision (c) of section 998 now reads: "(c)(1) If an offer made by a defendant is not accepted and the plaintiff fails to obtain a more favorable judgment or award, the plaintiff shall not recover his or her postoffer costs and shall pay the defendant's costs from the time of the offer. In addition, in any action or proceeding other than an eminent domain action, the court or arbitrator, in its discretion, may require the plaintiff to pay a reasonable sum to cover costs of the services of expert witnesses, who are not regular employees of any party, actually incurred and reasonably necessary in preparation for trial or arbitration of the case by the defendant." (Italics added.)

At oral argument, defendant suggested that the language in the first sentence excluding the plaintiff's "postoffer costs" was also intended to preclude a determination that the plaintiff is a prevailing party for purposes of an award of preoffer attorney fees under section 1717. In essence, as defendant further suggested, whether the plaintiff prevailed for purposes of preoffer attorney fees under section 1717 should be determined by whether the plaintiff obtained a judgment more favorable than the defendant's section 998 offer. Defendant also suggested that the current version of section 998 should apply retroactively to this case. We discern from the Legislature's addition of the word "postoffer" to section 998 no purpose to preclude prevailing plaintiffs from receiving preoffer attorney fees to which they are otherwise entitled under section 1717; to the contrary, the language on its face limits the effect of section 998 on a prevailing plaintiff to postoffer costs, including attorney fees. Accordingly, we need not address whether, contrary to the usual presumption of nonretroactivity, the current version of section 998 should be applied retroactively to trials already completed at the time of its enactment. (See Western Security Bank v. Superior Court (1997) 15 Cal.4th 232, 243-244,
[2]  Plaintiff argues that Code of Civil Procedure section 1021.1, a temporary statute applying to only two counties first enacted in 1987 and scheduled to repeal itself in 2001, shows that the Legislature did not intend the costs shifted from the defendant to the plaintiff under section 998 to include a defendant's attorney fees. Section 1021.1 provides that, when a party rejects a section 998 settlement offer and thereafter fails to obtain a more favorable judgment, the trial court has discretion to award attorney fees to the party that made the rejected settlement offer. Plaintiff argues that, by implication, the Legislature did not intend that attorney fees would otherwise be available to a losing defendant under section 998. Plaintiff ignores, however, that section 1021.1 authorizes attorney fees in the absence of any other statutory or contractual basis for them, and that it expressly recognizes and preserves the right to attorney fees under any other contractual or statutory provision for attorney fees, as exists here: "Nothing in this section shall be construed to repeal or modify any other statutory provision for the award of attorney's fees or to diminish any express or implied contractual right which a party to a civil action may otherwise have to obtain an award of attorney's fees for the prosecution or defense of an action." (Code Civ. Proc. § 1021.1, subd. (e).)
[3]  Ordinarily, the categories of postoffer costs to which a defendant is entitled under section 998 will be the same as the categories of preoffer costs to which the plaintiff is entitled. This will not always be true, however, because the Legislature has in certain limited instances made a policy decision to treat prevailing plaintiffs and prevailing defendants differently for purposes of attorney fees and other costs. Section 998 takes these differences as it finds them, applying them for purposes of postoffer costs as if the defendant were the prevailing party but neither expanding nor contracting the categories of costs to which a prevailing defendant in the circumstances would be entitled. Thus, if the case is governed by a statute under which a prevailing plaintiff but not a prevailing defendant is entitled to attorney fees, then a defendant who does not prevail but is nonetheless entitled to its postoffer costs under section 998 is not entitled to its postoffer attorney fees as part of those costs, even though the prevailing plaintiff may obtain its preoffer attorney fees as part of its preoffer costs. (See Murillo v. Fleetwood Enterprises, Inc. (1998) 17 Cal.4th 985, 994, 73 Cal.Rptr.2d 682, 953 P.2d 858 [relevant statute authorized attorney fees for prevailing plaintiffs only].)
[4]  The position of the Court of Appeal would also be contrary to the policy of mutual treatment of defendants and plaintiffs with respect to contractual attorney fees provisions that underlies section 1717. It would destroy that mutuality to treat attorney fees as costs for purposes of the plaintiff's preoffer costs but not for purposes of the defendant's postoffer costs.
[5]  Because we conclude that defendant was entitled to its postoffer attorney fees and other costs under section 998, it is unnecessary to address the trial court's alternative theory that defendant was entitled to those fees and costs under section 1717 as well because it was the "prevailing party" on the issue of entitlement to postoffer costs, even though it was not the prevailing party with respect to the lawsuit as a whole.
