
829 A.2d 532 (2003)
376 Md. 142
Margie E. GLOVER
v.
Parris N. GLENDENING, et al.
No. 97, Sept. Term, 2001.
Court of Appeals of Maryland.
July 29, 2003.
*533 Antonio Ponvert, III, Bridgeport, CT (Pro Hac Vice) (Marc Seldin Rosen, Kristofer P. Cubello of Shar, Rosen & Warshaw, LLC, Baltimore, all on brief), for appellant.
Carmen M. Shepard, Deputy Atty. Gen. (J. Joseph Curran, Jr., Atty. Gen. of MD, Margaret Ann Nolan and Elizabeth M. Kameen, Asst. Attys. Gen., on brief), Baltimore, for appellees.
Argued before BELL, C.J., and ELDRIDGE, RAKER, WILNER, CATHELL, HARRELL and BATTAGLIA, JJ.
ELDRIDGE, Judge.
This action for declaratory and injunctive relief against several Maryland officials was brought under the Maryland/federal medicaid program and the federal Medicaid Act, 42 U.S.C. § 1396 et seq.[1] The federal Medicaid Act, in 42 U.S.C. §§ 1396a(25), 1396a(45) and 1396k, provides for the assignment, by medicaid recipients to the State, of any rights which the medicaid recipients may have against third parties to recover for the medical care which the State paid for under the medicaid program. These sections go on to provide that the State shall take all reasonable measures to ascertain the liability of third parties and to seek reimbursement from third parties. Section 1396k goes on to provide in subsection (b) as follows:
"(b) Such part of any amount collected by the State under an assignment made under the provisions of this section shall be retained by the State as is necessary to reimburse it for medical assistance payments made on behalf of an individual with respect to whom such assignment was executed (with appropriate reimbursement of the Federal Government to the extent of its participation in the financing of such medical assistance), and the remainder of such amount collected shall be paid to such individual."
The dispositive issue in this case is whether subsection (b) is applicable to the future payments to the State of Maryland under the settlement of a lawsuit between the State (together with 46 other states) and the tobacco industry.[2] Along with every *534 other reported opinion which has considered the issue, we shall hold that 42 U.S.C. § 1396k(b) is not applicable to the settlement of the tobacco litigation between the State and the tobacco industry.

I.
The plaintiff-appellant, Margie E. Glover, filed in the Circuit Court for Baltimore City a complaint for declaratory and injunctive relief, naming as defendants the Governor of Maryland, the Attorney General of Maryland, the Secretary of the Maryland Department of Health and Mental Hygiene, the Deputy Secretary for Health Care Financing of the Maryland Department of Health and Mental Hygiene, the Treasurer of the State of Maryland, and the bank which is allegedly the escrow agent to receive and disburse to the State the funds paid pursuant to the settlement agreement. The suit was brought by Ms. Glover as a class action. Her complaint alleged that she is a citizen of Maryland "who suffers from smoking related emphysema," and that she has been a recipient of medicaid benefits to pay for medical care because of her emphysema.
Ms. Glover further alleged that the State of Maryland's lawsuit against the tobacco industry was brought "to recover billions of dollars for the past and future expenditures for medical assistance provided under Maryland's medicaid program" and "that, although the State asserted various different legal theories in its complaint, the purpose of the lawsuit was to recover funds paid through the state medicaid program as a result of its subrogation interest." Finally, the complaint alleged:
"The $4.4 billion that the State of Maryland is poised to receive from the tobacco companies exceeds even the most generous estimates of what the State of Maryland had actually paid for existing and viable claims on behalf of Medicaid recipients in this state who have suffered smoking-related injuries.
"This excess recovery belongs to the plaintiffs, and it must be disbursed to them."
The complaint stated that "[t]he plaintiff and the plaintiff class are entitled to a declaration of their rights and the defendants' obligations" under the medicaid program. Ms. Glover also sought an injunction requiring the disbursement of future excess funds to the plaintiff and the members of the class "before such proceeds are deposited in the state treasury or ... before they are expended on other things." In addition to relying upon sections of the federal Medicaid Act, the complaint invoked various provisions of the federal and state constitutions as well as numerous federal regulations.
The defendants filed a motion to dismiss or for summary judgment on two alternative grounds: (1) sovereign immunity, and (2) failure to state a cause of action. The defendants attached as an exhibit the lengthy settlement agreement between the states and the tobacco industry. Thereafter, the Circuit Court filed an extensive opinion, granted the motion to dismiss on the ground of sovereign immunity, and filed an order dismissing the action.
The plaintiffs appealed to the Court of Special Appeals and, prior to any proceedings in the intermediate appellate court, this Court issued a writ of certiorari. Glover v. Glendening, 366 Md. 273, 783 A.2d 653 (2001).
The parties' arguments in this Court are essentially the same as their arguments in the Circuit Court. The defendants contend that sovereign immunity bars this *535 action and that, even if the defendants lack immunity, the complaint failed to state a claim upon which relief can be granted. The defendants offer two alternative reasons in support of their contention that the complaint failed to state a claim. First, they argue that the State's suit against the tobacco industry was not an action under the assignment provisions of the federal Medicaid Act. Second, the defendants argue that a 1999 amendment to the federal Medicaid Act, 42 U.S.C. § 1396b(d)(3), makes it clear that 42 U.S.C. § 1396k(b) does not apply to the tobacco industry settlement funds at issue.
In response to the defendants' sovereign immunity argument, the plaintiff Glover points out that the relief which she seeks is entirely prospective, that she does not claim any of the tobacco settlement funds which have already been paid to the State, and that the action is against state officials rather than the State itself. Accordingly, Ms. Glover contends, sovereign immunity under Maryland law is not a bar to this action. Ms. Glover further argues that the State's suit against the tobacco industry was a medicaid assignment action and that the 1999 amendment to the federal Medicaid Act simply relieved the states of the obligation to reimburse the federal government out of the tobacco industry settlement proceeds.

II.
We agree with the plaintiff Glover that this action is not barred by Maryland sovereign immunity principles. Our recent opinion in Jackson v. Millstone, 369 Md. 575, 588-593, 801 A.2d 1034, 1041-1045 (2002), is dispositive of the sovereign immunity issue.
Like the present case, Jackson v. Millstone was an action by medicaid recipients, against a state official, for a declaratory judgment and injunctive relief with regard to future medicaid funds. In rejecting the defendant's reliance on sovereign immunity, we initially pointed out in Jackson, 369 Md. at 590, 801 A.2d at 1043, that where state governmental action "is invalid, sovereign immunity does not preclude a declaratory judgment action or suit for an injunction against the governmental official who is responsible...." While Jackson involved the validity of an administrative regulation relating to medicaid payments, whereas the instant case involves the validity of certain practices by state officials, there is no difference between the two cases with regard to sovereign immunity principles. This Court continued in Jackson as follows (369 Md. at 590-591, 801 A.2d at 1043):
"As Judge Delaplaine explained for the Court in Davis v. State, supra, 183 Md. [385] at 389, 37 A.2d [880] at 883, `if a person is directly affected by a statute, there is no reason why he should not be permitted to obtain a judicial declaration that the statute is unconstitutional.' The Court in Davis went on to point out that, in addition, `a court of equity has power to restrain the enforcement of a void statute or ordinance at the suit of a person injuriously affected.' Ibid. Specifically with regard to sovereign immunity, the Davis opinion held (183 Md. at 393, 37 A.2d at 885):
'Although a State may not be sued without its consent, an officer of the State acting under color of his official authority may be enjoined from enforcing a State law claimed to be repugnant to the State or Federal Constitution, even though such injunction may cause the State law to remain inoperative until the constitutional question is judicially determined.'

See also, e.g., Police Comm'n [Com'r] v. Siegel, 223 Md. 110, 115, 162 A.2d 727, 729, cert. denied, 364 U.S. 909, 81 S.Ct. *536 273, 5 L.Ed.2d 225 (1960); Pitts v. State Bd. of Examiners, 222 Md. 224, 226, 160 A.2d 200, 201 (1960); Pressman v. State Tax Commission, 204 Md. 78, 84, 102 A.2d 821, 825 (1954), and cases there cited; Baltimore Police v. Cherkes, 140 Md.App. 282, 309-310, 780 A.2d 410, 426-427 (2001)."
We also pointed out in Jackson, 369 Md. at 591-592, 801 A.2d at 1043-1044, with respect to federal law claims which can be asserted in state courts under 42 U.S.C. § 1983, "it is clear that the defendant-respondent Director of the Medical Care Financing and Compliance Administration has no immunity from prospective relief," citing Ritchie v. Donnelly, 324 Md. 344, 356, 597 A.2d 432, 437 (1991), and Okwa v. Harper, 360 Md. 161, 193 n. 16, 757 A.2d 118, 135 n. 16 (2000).
In language which is directly on point, this Court in Jackson concluded its sovereign immunity discussion as follows (369 Md. at 592-593, 801 A.2d at 1044):
"More specifically, courts have rejected the defense of immunity in actions for declaratory or injunctive relief against state officials, by eligible persons or health care providers under the medicaid program, who claim that state practices violate the federal Medicaid Act and/or implementing federal regulations. See, e.g., Wilder v. Virginia Hosp. Ass'n, 496 U.S. 498, 512, 110 S.Ct. 2510, 2518-2519, 110 L.Ed.2d 455, 468-469 (1990) (action against state officials, under 42 U.S.C. § 1983, for prospective injunctive relief, with the Court pointing out that the Medicaid Act `imposes a binding obligation on States participating in the Medicaid program ... and ... this obligation is enforceable under § 1983 by health care providers'); Westside Mothers v. Haveman, 289 F.3d 852 (6th Cir.2002) (Medicaid-eligible children under the age of 21 are entitled to injunctive relief, under 42 U.S.C. § 1983, requiring state officials to comply with the Medicaid Act); Antrican v. Odom, 290 F.3d 178 (4th Cir.2002) (Sovereign immunity does not preclude the plaintiffs from obtaining `an injunction mandating that in the future, State officials bring the [state] Medicaid program into compliance with the Medicaid Act. This mandate might potentially impact the State treasury, but it is nonetheless prospective'); Lewis v. New Mexico Dept. of Health, 261 F.3d 970 (10th Cir.2001) (The immunity defense is not available to state officials who are sued for injunctive relief to bring the state medicaid program in conformance with the Medicaid Act); Boatman v. Hammons, 164 F.3d 286 (6th Cir.1998) (Medicaid recipients are entitled, under 42 U.S.C. § 1983, to an injunction requiring state officials to comply with the Medicaid Act). See also Dalton v. Little Rock Family Planning Services, 516 U.S. 474, 116 S.Ct. 1063, 134 L.Ed.2d 115 (1996)."
See also, e.g., Cardenas v. Anzai, 311 F.3d 929, 934-938 (9th Cir.2002) (An action which was identical to the case at bar, and the United States Court of Appeals held that, "[b]ecause the plaintiffs seek to remedy an [alleged] ongoing violation of federal law, their claims fall squarely within the Ex parte Young[, 209 U.S. 123, 28 S.Ct. 441, 52 L.Ed. 714] doctrine," and "[w]e thus conclude that the plaintiffs' suit is not barred by sovereign immunity"); Harris v. Owens, 264 F.3d 1282, 1291 (10th Cir.2001) (same).[3]
*537 Consequently, the Circuit Court erred in dismissing this action on the ground of sovereign immunity.

III.
As earlier mentioned, the defendants offer two alternative grounds for their contention that the complaint failed to state a claim. First, they contend that the State's suit against the tobacco industry was not an assignment action under the federal Medicaid Act. Second, they assert that, even if the action against the tobacco industry were a medicaid assignment action, the 1999 amendment to the federal Medicaid Act, 42 U.S.C. § 1396b(d)(3), precludes recovery of any excess by a medicaid recipient. We need not and do not reach the first of these grounds. We agree with the defendants that, as a result of the 1999 amendment, the plaintiff and those similarly situated are not entitled to recover any of the so-called "excess" payments under the tobacco industry settlement with the State.
Section 1396b(d) of 42 U.S.C., which includes the critical language of the 1999 amendment in subsection (3)(B)(i) and (ii), provides in pertinent part as follows:
"(d) Estimates of State entitlement; installments; adjustments to reflect overpayments or underpayments; time for recovery or adjustment; uncollectable or discharged debts; obligated appropriations; disputed claims
"(1) Prior to the beginning of each quarter, the Secretary shall estimate the amount to which a State will be entitled under subsections (a) and (b) of this section for such quarter, such estimates to be based on (A) a report filed by the State containing its estimate of the total sum to be expended in such quarter in accordance with the provisions of such subsections, and stating the amount appropriated or made available by the State and its political subdivisions for such expenditures in such quarter, and if such amount is less than the State's proportionate share of the total sum of such estimated expenditures, the source or sources from which the difference is expected to be derived, and (B) such other investigation as the Secretary may find necessary.
"(2)(A) The Secretary shall then pay to the State, in such installments as he may determine, the amount so estimated, reduced or increased to the extent of any overpayment or underpayment which the Secretary determines was made under this section to such State for any prior quarter and with respect to which adjustment has not already been made under this subsection.
"(B) Expenditures for which payments were made to the State under subsection (a) of this section shall be treated as an overpayment to the extent that the State or local agency administering such plan has been reimbursed *538 for such expenditures by a third party pursuant to the provisions of its plan in compliance with section 1396a(a)(25) of this title.

* * *
"(3)(A) The pro rata share to which the United States is equitably entitled, as determined by the Secretary, of the net amount recovered during any quarter by the State or any political subdivision thereof with respect to medical assistance furnished under the State plan shall be considered an overpayment to be adjusted under this subsection.
"(B)(i) Subparagraph (A) and paragraph (2)(B) shall not apply to any amount recovered or paid to a State as part of the comprehensive settlement of November 1998 between manufacturers of tobacco products, as defined in section 5702(d) of Title 26 [26 U.S.C.A. § 5702(d) ], and State Attorneys General, or as part of any individual State settlement or judgment reached in litigation initiated or pursued by a State against one or more such manufacturers.
"(ii) Except as provided in subsection (i)(19), a State may use amounts recovered or paid to the State as part of a comprehensive or individual settlement, or a judgment, described in clause (i) for any expenditures determined appropriate by the State."
Subsection (3)(B)(ii) plainly exempts the State-tobacco industry settlement proceeds from the excess recovery provision in § 1396k(b). As Judge Diana Gribbon Motz stated for the United States Court of Appeals for the Fourth Circuit in a case similar to the present one, Strawser v. Atkins, 290 F.3d 720, 731, cert. denied, 537 U.S. 1045, 123 S.Ct. 618, 154 L.Ed.2d 516 (2002), with respect to subsection (3)(B)(ii), "[t]here is no ambiguity in this sentence: Congress declares that the states may spend any money they receive under the M.S.A. § [tobacco industry settlement agreement] on any expenditure."
In fact, every reported opinion which has considered the issue has rejected the position of the plaintiff Glover and has held that 42 U.S.C. § 1396k(b) is not applicable to the proceeds of the settlement between the states and the tobacco industry. See, e.g., Cardenas v. Anzai, supra, 311 F.3d at 939-940 ("Here, no ambiguity exists. By its express terms, § 1396b(d)(3)(B)(ii) allows the State ... to `use the amounts recovered or paid to the State as part of a comprehensive or individual settlement ... for any expenditures determined appropriate by the State.' This language is neither expressly nor impliedly limited to the portion of the settlement funds that would otherwise be recoverable by the federal government"); Strawser v. Atkins, supra, 290 F.3d at 730-734; Tyler v. Douglas, 280 F.3d 116, 121-124 (2d Cir.2001), cert. denied, 536 U.S. 906, 122 S.Ct. 2361, 153 L.Ed.2d 182 (2002) ("The language of paragraph (3)(B)(ii) is clear and unambiguous"); Greenless v. Almond, 277 F.3d 601, 606 (1st Cir.), cert. denied, 537 U.S. 814, 123 S.Ct. 75, 154 L.Ed.2d 17 (2002) ("Every court to consider the question has, however, decided that § 1396k(b) does not apply to the state tobacco settlements"); Harris v. Owens, supra, 264 F.3d at 1294-1297; McClendon v. Georgia Department of Community Health, 261 F.3d 1252, 1261-1262 (11th Cir.2001); Watson v. State of Texas, 261 F.3d 436, 443-445 (5th Cir.2001) (holding that § 1396k(b) is inapplicable because the state's suit against the tobacco industry was not a medicaid assignment action); California v. Superior Court, 83 Cal.App.4th 597, 99 Cal.Rptr.2d 735 (2000) (same); Brown v. The State of Minnesota, 617 N.W.2d 421 (Minn.App.2000), cert. denied, 532 U.S. 995, 121 S.Ct. 1655, 149 L.Ed.2d 638 (2001).
*539 We hold that, in light of the 1999 amendment to the federal Medicaid Act, 42 U.S.C. § 1396k(b) is not applicable to the settlement of the litigation between the State and the tobacco industry. The plaintiff Glover, and all others similarly situated, are not entitled to any future proceeds paid to the State under the settlement agreement with the tobacco industry.

IV.
If the Circuit Court had been correct in dismissing this action on the ground of sovereign immunity, then its failure to render a declaratory judgment would also have been correct. Nevertheless, we have held in Part II of this opinion that the Circuit Court erred in dismissing the action on the ground of sovereign immunity. Consequently, under our cases, the entry of a declaratory judgment is required. Even though the plaintiff Glover cannot in substance prevail, she is entitled to a declaratory judgment.
The fact that the plaintiff has failed to state a cause of action for injunctive relief, or failed to state a cause of action regarding the future tobacco settlement proceeds, does not, in a declaratory judgment action, relieve the court of the necessity to file a declaratory judgment. The plaintiff has stated a cause of action for a declaratory judgment despite the fact that the declaration will favor the defendants' position and be adverse to the plaintiff's position.
The governing principle was set forth over 40 years ago by Judge Prescott for the Court in Shapiro v. County Commissioners, 219 Md. 298, 302-303, 149 A.2d 396, 398-399 (1959):
"It should be borne in mind that a demurrer is rarely appropriate in a declaratory judgment action. Where a bill of complaint shows a subject matter that is within the contemplation of the relief afforded by the declaratory decree statute, and it states sufficient facts to show the existence of the subject matter and the dispute with reference thereto, upon which the court may exercise its declaratory power, it is immaterial that the ultimate ruling may be unfavorable to the plaintiff. The test of the sufficiency of the bill is not whether it shows that the plaintiff is entitled to the declaration of rights or interest in accordance with his theory, but whether he is entitled to a declaration at all; so, even though the plaintiff may be on the losing side of the dispute, if he states the existence of a controversy which should be settled, he states a cause of suit for a declaratory decree. 1 Anderson, Declaratory Judgments, Section 318."
More recently, Judge Smith for the Court in Broadwater v. State, 303 Md. 461, 465, 467, 494 A.2d 934, 936, 937 (1985), in the context of a motion to dismiss for failure to state a claim, pointed out:
"Legions of our cases hold that a demurrer, the type of motion to dismiss here involved, is rarely appropriate in a declaratory judgment action. See, e.g., State v. Burning Tree Club, 301 Md. 9, 16-18, 481 A.2d 785, 788-89 (1984); City of Bowie v. Area Dev. Corp., 261 Md. 446, 456, 276 A.2d 90,95(1971); Borders v. Board of Education, 259 Md. 256, 258-59, 269 A.2d 570, 571 (1970); Balto. Import Car v. Md. Port Auth., 258 Md. 335, 338-39, 265 A.2d 866, 867-68 (1970); Merc.-Safe Dep. & Tr. v. Reg. of Wills, 257 Md. 454, 459, 263 A.2d 543, 545-46 (1970); Kacur v. Employers Mut. Cas. Co., 253 Md. 500, 504 n. 2, 254 A.2d 156, 158 n. 2 (1969); Woodland Beach Ass'n v. Worley, 253 Md. 442, 447-48, 253 Md. 442, 252 A.2d 827, 830 (1969); Causey v. Gray, 250 Md. 380, 391, 243 A.2d 575, 583-84 (1968); Garrett County v. Oakland, *540 249 Md. 400,401-02,249 Md. 400, 240 A.2d 228, 229 (1968); Hunt v. Montgomery County, 248 Md. 403, 408-10, 237 A.2d 35, 37-39 (1968); Queen Anne's County v. Miles, 246 Md. 355, 362, 228 A.2d 450, 453 (1967); Myers v. Chief of Fire Bureau, 237 Md. 583, 591, 207 A.2d 467, 471 (1965); Kelley v. Davis, 233 Md. 494, 498, 197 A.2d 230, 231 (1964); Md. Committee v. Tawes, 228 Md. 412, 419-20 n. 4, 180 A.2d 656, 659 n. 4 (1962); Shapiro v. County Comm. [Com'rs], 219 Md. 298, 302-03, 149 A.2d 396, 398-99 (1959).

* * *
"On the facts of this case the State erred in moving to dismiss for failure to state a cause of action and the trial judge erred in granting the motion to dismiss. It follows, therefore, that the trial judge should have declared the rights of the parties even if such declaration might be contrary to the desires of the plaintiff."
See also, e.g., Jackson v. Millstone, supra, 369 Md. at 593, 801 A.2d at 1045 ("Even if we agreed with the Department that the challenged regulation did not violate federal law, we would be required to reverse the Circuit Court's decision for failure to file a written declaratory judgment"); Baltimore v. Ross, 365 Md. 351, 358 n. 6, 779 A.2d 380, 384 n. 6 (2001) ("[T]his Court repeatedly has stated that where a plaintiff seeks a declaratory judgment, the trial court must file a written declaratory judgment"); Allstate v. State Farm, 363 Md. 106, 117 n. 1, 767 A.2d 831, 837 n. 1 (2001) ("We have admonished trial courts that, when a declaratory judgment action is brought and the controversy is appropriate for resolution by declaratory judgment, the court must enter a declaratory judgment"); Allied Inv. Corp. v. Jasen, 354 Md. 547, 556, 731 A.2d 957, 961 (1999) ("Granting a motion to dismiss a declaratory judgment action without declaring the rights of the parties rarely is appropriate"), and cases there cited. See also Bushey v. Northern Assurance, 362 Md. 626, 651-652, 766 A.2d 598, 611-612 (2001); Maryland HMOs v. Health Services Cost Review Commission, 356 Md. 581, 603, 741 A.2d 483, 494-495 (1999).
Although we are ruling in favor of the defendants on the merits of this controversy, the Circuit Court must enter a declaratory judgment.
JUDGMENT OF THE CIRCUIT COURT FOR BALTIMORE CITY VACATED AND CASE REMANDED TO THAT COURT FOR THE ENTRY OF A DECLARATORY JUDGMENT CONSISTENT WITH THIS OPINION. APPELLANT TO PAY COSTS.
NOTES
[1]  For recent reviews, by this Court, of the Maryland/federal medicaid program and the federal Medicaid Act, see Attorney Grievance Commission v. McLaughlin, 372 Md. 467, 494-497, 813 A.2d 1145, 1161-1163 (2002); Jackson v. Millstone, 369 Md. 575, 801 A.2d 1034 (2002); Dept. of Health v. Campbell, 364 Md. 108, 771 A.2d 1051 (2001).
[2]  Previous cases in this Court growing out of this lawsuit and settlement agreement include State v. State Board of Contract Appeals, 364 Md. 446, 773 A.2d 504 (2001), and Philip Morris Inc. v. Glendening, 349 Md. 660, 709 A.2d 1230 (1998).
[3]  Although one federal appellate court has reached a contrary decision, its holding was based on the Eleventh Amendment to the federal constitution. Barton v. Summers, 293 F.3d 944 (6th Cir.2002). The Eleventh Amendment, however, is not applicable to actions in a Maryland trial court. An Eleventh Amendment "argument is essentially one of federal court jurisdiction and federal constitutional law," Widgeon v. Eastern Shore Hospital Center, 300 Md. 520, 537, 479 A.2d 921, 929 (1984). See Hilton v. South Carolina Pub. Rys. Comm'n, 502 U.S. 197, 204-205, 112 S.Ct. 560, 565, 116 L.Ed.2d 560, 571 (1991), in which the Supreme Court emphasized: "[A]s we have stated on many occasions, `the Eleventh Amendment does not apply in state courts,'" quoting Will v. Michigan Dep't of State Police, 491 U.S. 58, 63-64, 109 S.Ct. 2304, 2308, 105 L.Ed.2d 45, 53 (1989). See also Maine v. Thiboutot, 448 U.S. 1, 9 n. 7, 100 S.Ct. 2502, 2507 n. 7, 65 L.Ed.2d 555, 563 n. 7 (1980) ("No Eleventh Amendment question is present, of course, where an action is brought in a state court since the Amendment, by its terms, restrains only `[t]he Judicial power of the United States'"); Nevada v. Hall, 440 U.S. 410, 420-421, 99 S.Ct. 1182, 1188, 59 L.Ed.2d 416, 425 (1979).
