
348 S.W.3d 44 (2011)
UNIVERSITY OF NORTH TEXAS, Appellant,
v.
CITY OF DENTON, Texas, acting by and through its Electric Utility Department, Denton Municipal Electric, Appellee.
No. 02-09-00395-CV.
Court of Appeals of Texas, Fort Worth.
April 14, 2011.
Rehearing Overruled August 18, 2011.
*45 Greg Abbott, Attorney General of Texas, Andrew Weber, First Assistant Attorney General, David S. Morales, Deputy Attorney General for Civil Litigation, James C. Ho, Solicitor General & James D. Blacklock, Assistant Solicitor General, Austin, TX, for Appellant.
Michael J. Whitten, The Whitten Law Firm, P.C., Michael S. Copeland, City of Denton, Texas, Utility Administration, Denton, TX, for Appellees.
PANEL: LIVINGSTON, C.J.; McCOY and MEIER, JJ.

OPINION
TERRIE LIVINGSTON, Chief Justice.
Appellant University of North Texas (UNT) appeals the trial court's order granting the motion for summary judgment of appellee City of Denton, Texas, acting by and through its electric utility department, Denton Municipal Electric (the City). In UNT's opening brief, it contended in two issues that the trial *46 court's order is improper because the court wrongly concluded that section 36.351 of the utilities code, which states that municipally owned utilities must give universities a 20% discount on the price of utility base rates, has expired and does not apply to the City's relationship with UNT. In UNT's reply brief, it argued that the City's lawsuit is barred by sovereign immunity. Because we agree that immunity precludes the suit, we reverse the trial court's judgment and remand this case to the trial court to afford the City an opportunity to amend its pleadings.

Brief Legislative Background
As part of the Public Utility Regulatory Act of 1995, the Texas Legislature passed a provision requiring each municipally owned utility to discount electric service provided to a university.[1] Act of May 27, 1995, 74th Leg., R.S., ch. 765, § 2.20, 1995 Tex. Gen. Laws 3972, 4007 (amended 1997) (current version at Tex. Util.Code Ann. § 36.351 (Vernon 2007)). The provision was amended and codified as section 36.351 in 1997. Act of May 8, 1997, 75th Leg., R.S., ch. 166, § 1, sec. 36.351, 1997 Tex. Gen. Laws 713, 784 (hereinafter section 36.351). Section 36.351, which has not been expressly repealed or amended since 1997, states in part,
(a) Notwithstanding any other provision of this title, each electric utility and municipally owned utility shall discount charges for electric service provided to a facility of a four-year state university, upper-level institution, Texas State Technical College, or college.
(b) The discount is a 20-percent reduction of the utility's base rates that would otherwise be paid under the applicable tariffed rate.
Tex. Util.Code Ann. § 36.351.
In 1999, the legislature passed Senate Bill 7, which partially deregulated Texas's electricity industry.[2] Act of May 27, 1999, 76th Leg., R.S., ch. 405, 1999 Tex. Gen. Laws 2543, 2543-2625; see In re Entergy Corp., 142 S.W.3d 316, 319 (Tex.2004) (orig. proceeding) (stating that Senate Bill 7 "dramatically altered the electric utility landscape in Texas by requiring the unbundling of generation, transmission, and distribution services" and "called for retail competition to begin" in 2002); BP Chems., Inc. v. AEP Tex. Cent. Co., 198 S.W.3d 449, 451 (Tex.App.-Corpus Christi 2006, no pet.) (explaining some of the effects of Senate Bill 7); State v. Pub. Util. Comm'n, 110 S.W.3d 580, 583 (Tex.App.-Austin 2003, no pet.) (same). An analysis issued during Senate Bill 7's legislative process states in part,
BACKGROUND: The state began regulating the electric utility industry in 1975 when lawmakers created the Public Utility Commission (PUC) to set standards and rates for both electric and local telephone service....
The electric utility industry is a $20-billion-a-year industry in Texas, with three general types of utilities:
 Investor-owned utilities, private companies owned by shareholders and regulated *47 by the PUC, sell electricity to about 70 percent of all customers in Texas....
 Rural electric cooperatives are owned by the communities they serve ....
 Municipal utilities are owned by cities. A municipal utility board is either elected or appointed by elected officials to set rates and make investments in infrastructure. Texas has 75 municipally owned utilities.
....
... [Senate Bill] 7 would restructure the electric utility industry in Texas to provide retail competition and customer choice beginning January 1, 2002, for all customers now served by investor-owned utilities.
House Comm. on State Affairs, Bill Analysis, Tex. S.B. 7, 76th Leg, R.S. (1999).
Section 63 of Senate Bill 7 (hereinafter section 63), an uncodified provision, states,
SECTION 63. Notwithstanding any other provision of this Act or Title 2, Utilities Code,[[3]] any person or entity that provides electric service to a four-year state university ... as provided by Section 36.351, Utilities Code, on December 31, 2001, shall continue to offer electric service to a four-year state university... as provided by Section 36.351, Utilities Code, until September 1, 2007, at a total rate that is no higher than the rate applicable to the university... on December 31, 2001. The rate applicable to a four-year state university... as provided by Section 36.351, Utilities Code, on December 31, 2001, shall be based on the rates provided for or described in Section 36.351, Utilities Code.... As used in this section, "person or entity" includes an electric utility, affiliated retail electric provider, municipal corporation, cooperative corporation, or river authority.
Act of May 27, 1999, 76th Leg., R.S., ch. 405, § 63, 1999 Tex. Gen. Laws 2543, 2625.

The Relationship Between the Parties and the History of Their Dispute
The City operates Denton Municipal Electric (DME), which is a municipally owned utility.[4] UNT is one of DME's customers.[5] Beginning in September 1995, DME gave UNT a 20% discount from DME's base rates; the discount was "subsidized by all other ... ratepayers." On September 1, 2007, DME, under the direction of ordinances passed by the Denton City Council, discontinued the discount. DME had notified UNT that it would remove the discount by a letter sent in 2004.
UNT started disputing DME's electricity billings in September 2007 because it claimed it was still entitled to the discount; "[d]espite repeated demands" by DME, the university withheld 20% of the amount of each monthly billing. According to DME, as of October 2008, by withholding 20% of each bill, UNT was delinquent in its payments for electric base rate service in the amount of $753,845.53.
In February 2008, the City sued UNT.[6] The City's petition sought, under chapter thirty-seven of the civil practice and remedies code, the Uniform Declaratory Judgments Act (UDJA), a declaration that *48 DME is not required to provide UNT the discount.[7] The petition also requested recovery for underpayments under chapter 2251 of the government code,[8] interest, and attorney's fees. The City contended that section 63 caused section 36.351's discount to expire on September 1, 2007 (even though the legislature did not expressly repeal section 36.351) and that section 105.203 of the education code also negated any affirmative duty by the City to provide further discounts.[9] UNT answered the suit by asserting a general denial and the defense of sovereign immunity, among other defenses.
The City filed a motion for summary judgment on all of its claims. It asserted that UNT owed DME unpaid balances. UNT also sought summary judgment on its interpretation of the relevant statutes (it did not raise sovereign immunity in its motion). The university attached documents from disputes before the Public Utility Commission; the documents showed that the commission had endorsed UNT's position that section 36.351's discount had not expired because of section 63.
The trial court granted judgment for the City on its declaratory judgment claim. It found that the City was "entitled to judgment as a matter of law that as of September 1, 2007, DME was no longer obligated to provide UNT a 20% base rate discount for electrical services" because of both section 63 of Senate Bill 7 and section 105.203 of the education code. The trial court also awarded up to $45,500 in attorney's fees to the City.
In anticipation of an appeal by UNT, the parties entered into a settlement agreement that contained the following terms, among others:
 the City would nonsuit all claims other than its declaratory judgment claim;
 beginning with the May 2009 bill, UNT would fully pay each of DME's electric bills, but until UNT's appeal is resolved, it may keep the $1,071,245.49 it had withheld from the September 2007 through April 2009 bills;
 if the appeal is resolved in UNT's favor, it can keep the $1,071,245.49, and it will be entitled to a credit against future electric bills for the additional 20% (plus interest) it paid starting with the May 2009 bill;
 if the appeal is resolved in the City's favor, UNT must pay the $1,071,245.49 (plus interest) to the City;
 after the resolution of the appeal, the winning party must pay the losing party's attorney's fees.
In accordance with the agreement, on the same day that the court entered its judgment, the City nonsuited all claims except for its declaratory judgment claim.[10] UNT filed notice of this appeal.


*49 Sovereign Immunity
Because sovereign immunity from suit affects subject matter jurisdiction, it may be raised for the first time on appeal. See Reata Constr. Corp. v. City of Dallas, 197 S.W.3d 371, 374 (Tex.2006) (op. on reh'g); Tex. Dep't of Parks & Wildlife v. Miranda, 133 S.W.3d 217, 224 (Tex. 2004); Tex. Ass'n of Bus. v. Tex. Air Control Bd., 852 S.W.2d 440, 443-44 (Tex.1993) (explaining that subject matter jurisdiction is "essential to the authority of a court to decide a case" and "is never presumed and cannot be waived"). As we have explained,
The Texas Supreme Court has long recognized that sovereign immunity protects the State of Texas, its agencies, and its officials from lawsuits for damages, absent legislative consent to sue. Immunity from suit bars a suit against the State unless the State has expressly consented to the suit. Legislative consent to suit must be by clear and unambiguous language, in either a statute or by other express legislative permission. Absent the State's consent to suit, a trial court lacks subject matter jurisdiction over a suit against a governmental entity.[[11]]
Dallas-Fort Worth Int'l. Airport Bd. v. Ryan, 52 S.W.3d 426, 428 (Tex.App.-Fort Worth 2001, no pet.) (footnotes and citations omitted); see Tex. Dep't of Criminal Justice v. McBride, 317 S.W.3d 731, 732 (Tex.2010) ("Sovereign immunity protects the State (and various divisions of state government) from lawsuits for money damages."); Tex. Dep't of Transp. v. York, 284 S.W.3d 844, 846 (Tex.2009); see also Dir. of Dep't of Agric. & Env't v. Printing Indus. Ass'n of Tex., 600 S.W.2d 264, 265 (Tex.1980) (indicating that immunity generally applies to a suit brought to control state action even when it does not subject the state to financial liability); Creedmoor-Maha Water Supply Corp. v. Tex. Comm'n on Envtl. Quality, 307 S.W.3d 505, 515 (Tex.App.-Austin 2010, no pet.) (same).
Sovereign immunity assists governmental functions by requiring tax resources to be used for their intended purposes rather than defending lawsuits. Reata Constr. Corp., 197 S.W.3d at 375. In other words, the "Legislature is better suited than the courts to weigh the conflicting public policies associated with waiving immunity and exposing the government to increased liability, the burden of which the general public must ultimately bear." Tex. Natural Res. Conservation Comm'n v. IT-Davy, 74 S.W.3d 849, 854 (Tex.2002) (plurality op.); see also Tex. Gov't Code Ann. § 311.034 (Vernon Supp. 2010) ("In order to preserve the legislature's interest in managing state fiscal matters through the appropriations process, a statute shall not be construed as a waiver of sovereign immunity unless the waiver is effected by clear and unambiguous language."). UNT generally enjoys sovereign immunity. See Nat'l Sports & Spirit, Inc. v. Univ. of N. Tex., 117 S.W.3d 76, 81 (Tex.App.-Fort Worth 2003, no pet.) ("As an agency of the State, UNT enjoys the protection afforded by this sovereign immunity, except in instances where immunity has been expressly waived by statute.").
In some circumstances, Texas law allows courts to declare rights, status, and other *50 legal relations whether or not further relief is or could be claimed. Tex. Civ. Prac. & Rem.Code Ann. § 37.003(a); see Chenault v. Phillips, 914 S.W.2d 140, 141 (Tex.1996) (explaining that the UDJA is not a grant of jurisdiction but merely a procedural device for deciding cases already within a court's jurisdiction). Specifically, a person "whose rights ... are affected by a statute, municipal ordinance, contract, or franchise may have determined any question of construction or validity arising under the instrument, statute, ordinance, contract, or franchise and obtain a declaration of rights, status, or other legal relations thereunder." Tex. Civ. Prac. & Rem.Code Ann. § 37.004(a). "When declaratory relief is sought, all persons who have or claim any interest that would be affected by the declaration must be made parties." Id. § 37.006(a).
Some suits against the government for declaratory relief do not implicate sovereign immunity. See, e.g., Tex. Educ. Agency v. Leeper, 893 S.W.2d 432, 433-40, 446 (Tex.1994) (holding that the State's immunity was waived when class-action plaintiffs sought a declaration concerning whether a statutory private school exemption to public school attendance requirements applied to home-schooled children); Hawkins v. El Paso First Health Plans, Inc., 214 S.W.3d 709, 711, 715-18 (Tex. App.-Austin 2007, pet. denied) (holding that the Texas Health and Human Services Commission did not have immunity in a declaratory judgment suit about whether the commission was responsible for disenrolling certain newborns from managed care plans); Tex. Dep't of Ins., Div. of Workers' Comp. v. Lumbermens Mut. Cas. Co., 212 S.W.3d 870, 874-75 (Tex.App.-Austin 2006, pet. denied) (op. on reh'g) (holding that sovereign immunity did not bar a lawsuit seeking a declaration that the department of insurance issued improper advisories regarding the effect of medical conditions). A legion of cases explain, however, that when a plaintiff seeks a declaration with the purpose of recovering damages from the State, immunity precludes the suit. See IT-Davy, 74 S.W.3d at 855-56 (stating that classifying a suit as a declaratory judgment action does not "change [the] suit's underlying nature" and explaining that "private parties cannot circumvent the State's sovereign immunity from suit by characterizing a suit for money damages ... as a declaratory-judgment claim"); City of Dallas v. Blanton, 200 S.W.3d 266, 280 (Tex.App.-Dallas 2006, no pet.) (rendering a judgment of dismissal because the plaintiff's declaratory judgment claim, which concerned the construction of a Dallas city code section, sought to impose liability for damages); Nueces Cnty. v. Ferguson, 97 S.W.3d 205, 218, 220-24 (Tex.App.-Corpus Christi 2002, no pet.) (dismissing a suit for damages because the "supreme court has been adamant... that where a party brings a suit ostensibly to determine or protect rights but actually seeks monetary damages, sovereign immunity bars such a suit"); City of San Benito v. Ebarb, 88 S.W.3d 711, 721-24 (Tex.App.-Corpus Christi 2002, pet. denied) (citing and relying on several other cases in which courts held that a declaratory judgment action could not be used as a backdoor avenue to collect damages); see also Town of Double Oak v. McDaniel, No. 02-09-00046-CV, 2009 WL 2579613, at *3 (Tex.App.-Fort Worth Aug. 20, 2009, no pet.) (mem. op.) (holding that a declaratory judgment action concerning the construction of ordinances was barred by immunity because the declaration sought the refund of alleged overcharges).
The City argues that the trial court's summary judgment order "grants only declaratory relief" and contends that all "claims that could have been construed as attempts to require UNT to pay damages *51 were dismissed." But although the trial court's declaration does not expressly mention money owed by UNT to the City, the purpose and effect of the declaration is for UNT to pay the 20% of the City's electric bills that UNT has withheld since September 2007. This fact is made obvious by the parties' settlement agreement, which requires UNT to pay more than $1,071,245.49 to the City if we (or the Texas Supreme Court) were to uphold the trial court's declaration that section 36.351's discount has expired.
The agreement also states that if UNT does not abide by the settlement, "all applicable statutes of limitation ... will be tolled as to the reassertion by [the City] of the claims ... it has agreed to dismiss, and such claims may be reasserted as if they had never been dismissed." Thus, the City preserved its ability to use the trial court's declaration during potential litigation of the breach of contract or prompt payment claims that it nonsuited. The City's suggestion that it will not use the declaration to compel UNT's payment of money is unfounded; sovereign immunity may not be waived by agreements used to minimize the underlying relief sought. See IT-Davy, 74 S.W.3d at 855-56; Smith v. Abbott, 311 S.W.3d 62, 80 (Tex.App.-Austin 2010, pet. denied) (op. on reh'g) ("[S]overeign immunity will bar an otherwise proper UDJA claim that has the effect of establishing a right to relief against the State for which sovereign immunity has not been waived."); Newman v. Kock, 274 S.W.3d 697, 702 (Tex.App.-San Antonio 2008, no pet.) ("A plaintiff cannot circumvent sovereign immunity by characterizing his suit as a declaratory judgment action for which immunity is waived when the plaintiff seeks relief for which sovereign immunity has not been waived.").
Both parties rely on City of El Paso v. Heinrich for their opposing arguments regarding sovereign immunity. 284 S.W.3d 366 (Tex.2009). In Heinrich, a police employee's widow had received monthly survivor benefits based on a pension her husband had earned. Id. at 369. When the board of trustees of the pension fund reduced Heinrich's payment, she filed a lawsuit against the City of El Paso (among other parties) seeking declaratory relief and an injunction. Id. The city pled immunity from suit, but the trial court denied the plea, and the court of appeals affirmed. Id.
Before the supreme court, the city contended that "although Heinrich request[ed] declaratory and equitable relief, her claim [was] essentially for past and future money damages, and that governmental immunity therefore bar[red] her suit." Id. Heinrich argued that because her claim alleged a reduction in benefits that was legally unauthorized, it was not barred. Id. at 370. The supreme court rejected Heinrich's contention, stating that the UDJA
is a remedial statute designed "to settle and to afford relief from uncertainty and insecurity with respect to rights, status, and other legal relations." ... The Act, however, does not enlarge a trial court's jurisdiction, and a litigant's request for declaratory relief does not alter a suit's underlying nature. It is well settled that "private parties cannot circumvent the State's sovereign immunity from suit by characterizing a suit for money damages... as a declaratory-judgment claim." ...
... [W]hile suits for contract damages against the state are generally barred by immunity, where a statute or the constitution requires that government contracts be made or performed in a certain way, leaving no room for discretion, a suit alleging a government official's *52 violation of that law is not barred, even though it necessarily involves a contract....
....
... In other words, where statutory or constitutional provisions create an entitlement to payment, suits seeking to require state officers to comply with the law are not barred by immunity merely because they compel the state to make those payments....
From this rationale, it is clear that suits to require state officials to comply with statutory or constitutional provisions are not prohibited by sovereign immunity, even if a declaration to that effect compels the payment of money. To fall within this ultra vires exception, a suit must not complain of a government officer's exercise of discretion, but rather must allege, and ultimately prove, that the officer acted without legal authority or failed to perform a purely ministerial act....
....
Nonetheless, as a technical matter, the governmental entities themselves as opposed to their officers in their official capacityremain immune from suit.... [B]ecause the rule that ultra vires suits are not "suit[s] against the State within the rule of immunity of the State from suit" derives from the premise that the "acts of officials which are not lawfully authorized are not acts of the State," ..., it follows that these suits cannot be brought against the state, which retains immunity, but must be brought against the state actors in their official capacity. This is true even though the suit is, for all practical purposes, against the state....
....
... [A] claimant who successfully proves an ultra vires claim is entitled to prospective injunctive relief, as measured from the date of injunction.
Id. at 370-76 (citations and footnotes omitted).
Here, the City has sued only UNT, not any of UNT's officials, and the City concedes that it has not brought an ultra vires claim.[12] Instead, the City relies on a footnote in Heinrich to contend that the UDJA waives UNT's sovereign immunity in this suit. During the supreme court's discussion about the "Proper Parties" (as opposed to the "Permissible Relief") in a declaratory judgment suit, the court stated,
For claims challenging the validity of ordinances or statutes, however, the Declaratory Judgment Act requires that the relevant governmental entities be made parties, and thereby waives immunity. Tex. Civ. Prac. & Rem.Code § 37.006(b) ("In any proceeding that involves the validity of a municipal ordinance or franchise, the municipality must be made a party and is entitled to be heard, and if the statute, ordinance, or franchise is alleged to be unconstitutional, the attorney general of the state must also be served with a copy of the proceeding and is entitled to be heard."); see Wichita Falls State Hosp. v. Taylor, 106 S.W.3d 692, 697-698 (Tex.2003) ("[I]f the Legislature requires that the State be joined in a lawsuit for which immunity would otherwise attach, the Legislature has intentionally waived the *53 State's sovereign immunity."); Tex. Educ. Agency v. Leeper, 893 S.W.2d 432, 446 (Tex.1994) ("The DJA expressly provides that persons may challenge ordinances or statutes, and that governmental entities must be joined or notified. Governmental entities joined as parties may be bound by a court's declaration on their ordinances or statutes. The Act thus contemplates that governmental entities may beindeed, must bejoined in suits to construe their legislative pronouncements."). Here, Heinrich is not challenging the validity of the bylaws or the governing statute, but rather petitioners' actions under them.
Id. at 373 n. 6; see also Tex. Lottery Comm'n v. First State Bank of DeQueen, 325 S.W.3d 628, 633-35 (Tex.2010) (relying on footnote six of Heinrich to hold that the Texas Lottery Commission did not have immunity from a suit that challenged the validity of a statutory prize-assignment restriction that conflicted with another statute).[13]
The City argues that because this case involves the validity of its own ordinances that deleted the 20% discount and the construction of statutes that affect whether the 20% discount applies, the "present case fits precisely the exception recognized by footnote 6 to the Heinrich opinion." But the supreme court's holdings in cases before Heinrich preclude the City's contention that the rationale of the Heinrich footnote applies to cases in which the underlying purpose of the suit is to impose financial liability. For example, although the Heinrich court (and the DeQueen court) relied on Leeper to conclude that immunity of governmental parties is waived (in some circumstances) when they must be joined to a suit that seeks to construe or challenge a statute, the IT-Davy court, when discussing that exception from Leeper, stated,
IT-Davy misplaces its reliance on Leeper. In Leeper, home-school parents and curriculum providers brought a class-action suit against state officials, challenging the Texas Education Agency's construction of the compulsory school-attendance law. They sought a declaration that the compulsory attendance law's private-school exemption includes home-schooled children, and therefore, the home-school parents could not be prosecuted for keeping their children home. We determined that the DJA expressly allows persons to challenge ordinances or statutes. Moreover, the DJA requires challengers to join governmental entities in suits to construe legislative pronouncements, and the DJA authorizes awarding attorneys' fees. Accordingly, we held that the DJA necessarily waives governmental immunity for attorneys' fees in suits to construe legislative pronouncements.
However, Leeper's limited waiver does not allow private parties to sue the State for money damages under the DJA.

IT-Davy, 74 S.W.3d at 859-60 (citations omitted) (emphasis added).
Similarly, just two years before deciding Heinrich, the supreme court reiterated IT-Davy's holding that statutory challenges in declaratory judgment claims do *54 not always waive the government's immunity. See City of Houston v. Williams, 216 S.W.3d 827, 829 (Tex.2007). In Williams, a group of firefighters sued the city to recover amounts deducted from payments they received upon termination of their employment. Id. at 828. Although the firefighters' claim for declaratory relief concerned a "legitimate question of statutory interpretation," the supreme court held that "in every suit against a governmental entity for money damages, a court must first determine the parties' contract or statutory rights; if the sole purpose of such a declaration is to obtain a money judgment, immunity is not waived." Id. at 829.
Various courts of appeals have likewise recognized that the sovereign immunity waiver discussed in Leeper and footnote six of Heinrich does not apply when the underlying basis of the claim is to impose financial liability. See Gatesco Q.M., Ltd. v. City of Houston, 333 S.W.3d 338, 348 (Tex.App.-Houston [14th Dist.] 2010, no pet.) (citing Leeper, Heinrich, and DeQueen, but then explaining that if a litigant seeks an otherwise proper declaratory judgment "construing or invalidating a statute, this claim is nonetheless barred by governmental immunity if the declaration sought would have the effect of establishing a right to relief against the governmental entity for which governmental immunity has not been waived") (emphasis added); Creedmoor-Maha Water Supply Corp., 307 S.W.3d at 515; State v. BP Am. Prod. Co., 290 S.W.3d 345, 360 (Tex. App.-Austin 2009, pet. filed); Ebarb, 88 S.W.3d at 721 ("While the UDJA allows private parties to challenge ordinances or statutes, it does not authorize them to sue the State for money damages.").
We note that the City has not argued that the settlement agreement independently waives UNT's immunity. During oral argument, the City's attorney opined that the settlement agreement does not affect UNT's immunity because "only the legislature can waive sovereign immunity." A settlement agreement is a contract. Doe v. Tex. Ass'n of Sch. Bds., Inc., 283 S.W.3d 451, 458 (Tex.App.-Fort Worth 2009, pet. denied). The supreme court has held that a governmental entity does not waive immunity from suit merely by entering into a contract or accepting benefits of the contract. Tex. A & M Univ.-Kingsville v. Lawson, 87 S.W.3d 518, 520 (Tex. 2002) (plurality op.); Gen. Servs. Comm'n v. Little-Tex Insulation Co., 39 S.W.3d 591, 594 (Tex.2001) ("[T]he State does not waive immunity from suit simply by contracting with a private person .... Legislative consent to sue is still necessary.").
In Lawson, the supreme court held that when a governmental entity settles a claim from which the entity did not have immunity, the entity likewise does not have immunity for a breach of the settlement agreement. Lawson, 87 S.W.3d at 521. We conclude that Lawson implies, therefore, that an entity's immunity is not waived when a governmental entity settles a claim from which the entity has immunity (otherwise, the supreme court could have streamlined its opinion by holding that settlement agreements always waive immunity).
In an apparent effort to avoid the strictures of sovereign immunity, the parties' settlement agreement essentially traded the dismissal of the City's prompt payment and breach of contract claims, which were centered on imposing financial liability on the State, for a guarantee that the State would nonetheless pay the money requested by those claims if it failed to overturn the trial court's declaratory judgment (which does not facially award *55 damages) on appeal.[14] While we normally encourage parties to settle their disagreements whenever possible, we are constrained by our supreme court's precedent. We are therefore compelled to hold that the parties in this case could not avoid sovereign immunity by their contract, and therefore alter a court's subject matter jurisdiction, in that fashion.[15]See Dubai Petroleum Co. v. Kazi, 12 S.W.3d 71, 76 (Tex.2000) (explaining that subject matter jurisdiction "cannot be conferred upon any court by consent or waiver") (quoting Fed. Underwriters Exch. v. Pugh, 141 Tex. 539, 541, 174 S.W.2d 598, 600 (1943)); Russ Berrie & Co. v. Gantt, 998 S.W.2d 713, 715 (Tex.App.-El Paso 1999, no pet.) ("[T]his is a matter of subject matter jurisdiction and we must determine sua sponte whether we have the authority to hear this action as framed; the parties cannot confer jurisdiction by agreement."). This is not a case in which the City's claim for damages is germane to, connected with, properly defensive to, and offsetting of a claim for damages by UNT.[16]See Reata Constr. Corp., 197 S.W.3d at 373, 376-77.
For all of these reasons, we hold that UNT is immune from the City's UDJA claim because that claim ultimately imposes damages on the State. See McBride, 317 S.W.3d at 732; Ryan, 52 S.W.3d at 428. UNT's immunity deprived the trial court of subject matter jurisdiction.

Conclusion
Having determined that the trial court did not have subject matter jurisdiction over the City's UDJA claim, and because the jurisdictional defects may not be "incurable" with respect to the City's attempt to determine whether section 36.351's discount remains effective, we reverse the trial court's judgment and remand this case to the trial court to afford the City the opportunity to amend its pleadings. See Miranda, 133 S.W.3d at 224, 226-27; Wise Reg'l Health Sys. v. Brittain, 268 S.W.3d 799, 804 (Tex.App.-Fort Worth 2008, no pet.); see also Heinrich, 284 S.W.3d at 372-74, 376-77, 380.
NOTES
[1]  Supporters of the mandated discount believed that it would help keep the costs of higher education down; opponents argued that universities "consume electricity equivalent to sizable commercial ... operations" and "should not be specifically singled out for a substantial discount over other institutions." House Comm. on State Affairs, Bill Analysis, Tex. S.B. 373, 74th Leg., R.S. (1995).
[2]  Senate Bill 7's provisions principally amended and added to the utilities code, although they also amended other codes. See Act of May 27, 1999, 76th Leg., R.S., ch. 405, 1999 Tex. Gen. Laws 2543, 2543-2625.
[3]  Section 36.351 is part of Title 2 of the utilities code.
[4]  See Tex. Util.Code Ann. § 11.003(11) (Vernon 2007).
[5]  According to UNT, because the City has not opted to enter the competitive electric market, DME is the only service provider available to the university.
[6]  The City amended its petition in November 2008 to add a breach of contract claim.
[7]  See Tex. Civ. Prac. & Rem.Code Ann. §§ 37.001-.011 (Vernon 2008).
[8]  See Tex. Gov't Code Ann. §§ 2251.001-.055 (Vernon 2008).
[9]  Section 105.203 states,

The [board of regents of UNT] may contract with the City of Denton for the furnishing of water and other utility services to the university. The rates to be charged the university may not exceed those regularly established, published, and declared rates for similar customers. If there are no similar customers, the rates to be charged shall be those established by the City of Denton for commercial users. The city may make any adjustments, discounts, and special rates that the governing authorities of the city may consider appropriate to provide for the university.
Tex. Educ.Code Ann. § 105.203 (Vernon 2002).
[10]  See Tex.R. Civ. P. 162.
[11]  A plaintiff may obtain express legislative permission to sue a governmental entity in a particular case. See Tex. Dep't of Transp. v. Jones, 8 S.W.3d 636, 638 (Tex.1999). Sovereign immunity is also waived for constitutional takings claims. Foster v. Denton Indep. Sch. Dist., 73 S.W.3d 454, 460 (Tex.App.-Fort Worth 2002, no pet.). The City has not obtained express legislative permission to bring this suit, and it does not assert a takings claim.
[12]  UNT states that if the City's "view of the law is correct, UNT's officials have no discretion to continue to claim a right to the defunct 20% discount." We do not intend for this opinion to be construed as approving or precluding an ultra vires suit by the City against UNT's officials, nor do we intend for this opinion to comment on what relief could be available in that suit, if any.
[13]  Thus, DeQueen did not concern the State's liability for damages. Neither did Leeper. We note that there appears to be some tension between the supreme court's holding in DeQueen, in which the court held that a statutory challenge could be brought through the UDJA against the State, and its decision a few months earlier in Tex. Dep't of Ins. v. Reconveyance Servs., Inc., 306 S.W.3d 256, 258 (Tex.2010), in which the court held that a plaintiff's claim regarding the construction of portions of the insurance code must be brought as an ultra vires suit.
[14]  During oral argument, UNT's attorney stated, "The agreement was designed to allow the parties to recoup money from each other that the court may not have been able to order due to sovereign immunity." The City states, "The Settlement Agreement was made for the specific purpose of getting a clean ruling on the matter at issue unclouded by any sovereign immunity claims."
[15]  In the parties' agreement, the payment of money by the state is expressly conditioned on what the trial court decided on the UDJA claim and what we would decide on the same claim. Therefore, our decision on the merits would either compel the state to pay money or relieve it from doing so. We recognize that UNT's decision to enter into the settlement agreement appears to be incongruous with its sovereign immunity argument on appeal. The supreme court, however, has expressed that parties may not typically waive sovereign immunity by their conduct because it is the "Legislature's sole province to waive or abrogate sovereign immunity." IT-Davy, 74 S.W.3d at 857; see Tex. A & M Univ. Sys. v. Koseoglu, 233 S.W.3d 835, 840 (Tex.2007) (stating that the supreme court has "consistently rejected" waiver-by-conduct arguments).
[16]  UNT did not file a counterclaim in the trial court. The settlement agreement states that if UNT prevails on appeal, it will receive only a credit on future electric bills that is equal to 20% of its payment of the City's bills starting with the May 2009 bill, plus interest (in other words, UNT will receive a refund). The agreement also awards attorney's fees to the winning party, but attorney's fees connected to a proper UDJA claim are not barred by sovereign immunity. Leeper, 893 S.W.2d at 446; Ebarb, 88 S.W.3d at 724.
