
888 N.E.2d 694 (2008)
MIDWEST EMERGENCY ASSOCIATES-ELGIN LTD., and Sullivan Urgent Aid Centers, Ltd., d/b/a Sullivan Urgent Care Centers, Ltd., Individually and on Behalf of All Others Similarly Situated, Plaintiffs-Appellants,
v.
HARMONY HEALTH PLAN OF ILLINOIS, INC., Amerigroup Illinois, Inc., and United Healthcare of Illinois, Inc., Defendants-Appellees.
No. 1-07-0039.
Appellate Court of Illinois, First District, Fourth Division.
May 15, 2008.
Duane Morris LLP, of Chicago, IL (Richard P. Darke, of counsel); Duane Morris LLP, of Bangor, ME (Gregory A. *695 Brodek, of counsel); Duane Morris LLP, of Philadelphia, PA (Steven L. Friedman and Seth A. Goldberg, of counsel), for Appellant.
Drinker Biddle Gardner Carton, of Chicago, IL (Edwin E. Brooks, David S. Almeida and Annapurna Singh, of counsel), for Appellees/Cross-Appellants, Harmony Health Plan of Illinois, Inc. and Amerigroup Illinois, Inc.
Neal, Gerber & Eisenberg LLP, of Chicago, IL (James K. Gardner, Stephen Fedo and Juan W. Guarisco, of counsel), for Appellee, United Health Care of Illinois, Inc.
Justice CAMPBELL delivered the opinion of the court:
This is an appeal by plaintiffs, Midwest Emergency Associates-Elgin, Ltd., and Sullivan Urgent Aid Centers, Ltd., from an order of the circuit court of Cook County dismissing an action against defendants, Harmony Health Plan of Illinois, Inc., Amerigroup Illinois, Inc., and United Healthcare of Illinois, Inc, under section 2-619 of the Code of Civil Procedure. 735 ILCS 5/2-619 (West 2006).[1] This appeal concerns only Harmony Health Plan of Illinois Inc. and Amerigroup Illinois, Inc. (collectively Harmony Health).[2]
Midwest Emergency Associates-Elgin, Ltd. (Midwest), and Sullivan Urgent Aid Centers, Ltd. (Sullivan or, collectively, Midwest), are healthcare providers licensed by the State of Illinois, and Harmony Health administers Medicaid managed care programs. Midwest filed a putative class action against Harmony Health, seeking to recover the full billed amount for emergency medical services that Midwest provided to Medicaid beneficiaries enrolled in Harmony Health's managed care plans.
We find that Harmony Health reimbursed Midwest in accordance with federal and state law, as well as the parties' individual agreements as Medicaid providers, and therefore affirm the trial court's order granting Harmony Health's motion to dismiss.

STATUTORY BACKGROUND: MEDICAID REIMBURSEMENT
Medicaid is a joint federal and state government entitlement program that provides financial resources to needy persons for healthcare services. In Illinois, the Illinois Department of Healthcare and Family Services (HFS) is responsible for providing healthcare coverage to individuals who are eligible for Medicaid.

The Federal Medicaid Program
Title XIX of the Social Security Act (42 U.S.C. 1396 et seq. (2000)), creates a medical assistance program (Medicaid) that provides resources to low-income individuals and families for healthcare services. Harris v. McRae, 448 U.S. 297, 100 S.Ct. 2671, 65 L.Ed.2d 784 (1980). The Medicaid program is a jointly-funded federal and state government endeavor.
The United States Centers for Medicare and Medicaid Services (CMS) administers the Medicaid program at the federal level. See Pediatric Specialty Care, Inc. v. Arkansas Department of Human Services, 364 F.3d 925, 933 (8th Cir.2004). State participation in this program is optional; however, once a state elects to participate in the Medicaid program, it must comply with certain federal requirements as a condition *696 precedent to federal funding. 42 U.S.C. §§ 1396a(a), (b) (2000); Harris, 448 U.S. at 301, 100 S.Ct. at 2680, 65 L.Ed.2d at 794.
Participating states have wide latitude in designing and administering state Medicaid programs. For example, states may administer Medicaid benefits via either: (1) "fee-for-service" programs or (2) managed care programs. See Medicaid Managed Care, 63 Fed.Reg. 52022, 52022 (September 29, 1998).

Fee-for-Service
In the traditional fee-for-service arrangement, the state enters into direct provider plan agreements with healthcare service providers. Providers that filed a provider plan agreement with the state's Medicaid agency can submit claims for reimbursement directly to that agency. 42 U.S.C. § 1395(a) (2000). Reimbursement rates are predetermined by a fee schedule fixed by the state, and provider agreements provide that such payments constitute "payment in full." Specifically, the Social Security Act provides that "[a] State plan must provide that the Medicaid agency must limit participation in the Medicaid program to providers who accept, as payment in full, the amounts paid by the agency plus any deductible, coinsurance, or co-payment required by the plan to be paid by the individual." 42 C.F.R. § 447.15 (2007). This regulation is intended to minimize the financial strain on state Medicaid programs.

Managed Care
In a managed care arrangement, the state contracts with managed care organizations (MCOs), to provide medical benefits to Medicaid recipients. 42 U.S.C. § 1396b(m) (2000). In order to administer Medicaid benefits, an MCO must enter into an agreement with the state in which the MCO agrees to comply with all rules and regulations governing the Medicaid program.
MCOs then enter into private contracts with healthcare providers to establish provider networks. 42 U.S.C. § 1936b(m)(1)(A)(i) (2000). Medicaid beneficiaries are required to seek medical treatment from approved providers within their MCO's established network(s). The MCOs reimburse network providers for services at rates mutually agreed upon by contract. In exchange, MCOs receive a set monthly premium per Medicaid member from the state. 42 U.S.C. § 1396b(m)(2)(A)(iii)(2000).

The Illinois Medical Assistance Program
Illinois participates in the federal Medicaid program. 305 ILCS 5/5-1 et seq. (West 2006). The HFS is the state agency responsible for providing healthcare coverage for adults and children who qualify for Medicaid. American Society of Consultant Pharmacists v. Garner, 180 F.Supp.2d 953, 958 (N.D.Ill.2001).
Illinois's Medicaid participants can receive benefits through either a fee-for-service or a managed care arrangement. In the fee-for-service arrangement, HFS unilaterally sets the rate of reimbursement for the medical assistance for which payment is authorized. 89 Ill. Adm.Code. § 140.23(d), amended at 8 Ill. Reg 6785 (eff. April 27, 1984). In order to provide services to Illinois Medicaid recipients, providers must file with HFS an agreement for participation in the Illinois medical assistance program (HFS provider agreement); HFS provider agreements require providers to comply with certain minimum federal and state standards in order to participate in the state's Medicaid program; the agreements also govern the direct commercial relationship between HFS and providers. 89 Ill. Adm.Code § 140.11(a)(6), amended at 28 Ill. Reg. 4958 (eff. March 3, 2004).
*697 In accordance with federal law, HFS regulations state that:
"If a provider accepts an individual eligible for medical assistance from [HFS] as a Medicaid recipient, such provider shall not bill, demand, or otherwise seek reimbursement from that individual or from a financially responsible relative or representative of the individual for any service for which reimbursement would have been available from [HFS] if the provider had timely and properly billed [HFS]." 89 Ill. Adm.Code § 140.12(i)(1), amended at 31 Ill. Reg. 8485 (eff. May 30, 2007).
Under Illinois's managed care program, HFS enters into a contract for furnishing health services by a managed care organization (MCO agreement) with an MCO. 305 ILCS 5/5-11(b) (West 2006). MCO agreements provide that the MCOs, rather than HFS, underwrite and administer coverage for Medicaid enrollees. Thus, the MCOsand not HFSreimburse providers for services rendered to the MCO enrollees. 89 Ill. Adm.Code § 140.12(i)(1), amended at 31 Ill. Reg. 8485 (eff. May 30, 2007).
The delivery of medical services in an MCO arrangement is structured as follows: MCOs establish provider networks through private contracts with healthcare providers. An MCO's Medicaid enrollees are required to utilize healthcare providers within their MCO networks. See 42 C.F.R. § 438.206(b)(1) (2007). Providers and MCOs negotiate rates of reimbursement for services that may differ from the rates paid by the state in a fee-for-service arrangement. See 42 C.F.R. § 438.12(b)(2) (2007). In an MCO arrangement, the state and providers are not in privity of contract with each other in connection with reimbursement for services that are provided to an MCO's enrollees. Instead, HFS pays a participating MCO a fixed monthly payment, or "capitation payment," for each individual Medicaid beneficiary enrolled in the MCO's program. See Medicaid Managed Care, 63 Fed.Reg. 52022, 52022 (September 29, 1998).

Emergency Medical Services
Federal and state law place special requirements on healthcare providers and MCOs in connection with the provision of emergency medical treatment.
First, the Illinois Emergency Medical Treatment Act provides that "[n]o hospital, physician, dentist or other provider of professional healthcare licensed [in Illinois] may refuse to provide needed emergency treatment to any person whose life would be threatened in the absence of such treatment, because of that person's inability to pay therefor, nor because of the source of any payment promised therefor." 210 ILCS 70/1 (West 2006). Federal law likewise requires healthcare providers to perform "necessary stabilizing treatment for emergency medical conditions" regardless of a patient's inability to pay for such services. 42 U.S.C. § 1395dd(b) (2000). In connection with that mandate, federal Medicaid law requires that an MCO in contract with the state to administer a Medicaid managed care program must provide its enrollees with coverage for emergency medical services, regardless of whether the emergency healthcare provider is part of that MCO's approved provider network(s). 42 U.S.C. § 1396u-2(b)(2)(A)(i) (2000); 42 C.F.R. § 438.114(c)(1)(i) (2007).
Reflecting state and federal requirements pertaining to emergency medical services, MCO agreements with HFS provide an exception to standard MCO network restrictions in emergency situations. Specifically, the agreements provide that MCOs "shall pay for all appropriate Emergency Services rendered by a non-affiliated *698 provider * * * at the same rate [HFS] would pay for such services, unless a different rate was agreed upon." (Emphasis added).

FACTS
The following facts are relevant on appeal. Midwest and Sullivan are service corporations licensed by the State of Illinois to provide healthcare services to Illinois residents. Midwest entered into HFS provider agreements with the State to provide healthcare services to Medicaid beneficiaries. In return, Midwest agreed to accept reimbursement from HFS at the HFS fee-for-service rate. Specifically, the provider agreements provide that "[Midwest] shall receive payment based on [HFS'] reimbursement rate, which shall constitute payment in full."
Harmony Health Plan of Illinois, Inc., and Amerigroup Illinois, Inc. (collectively Harmony Health), are Illinois-licensed health maintenance organizations. Harmony Health entered into MCO agreements with HFS to administer managed care plans for the State of Illinois. Under these MCO agreements, Harmony Health is required to establish provider networks for its Medicaid enrollees. To do so, Harmony Health negotiates privately with healthcare providers to set rates at which providers will accept reimbursement for services rendered. In return, Harmony Health's Medicaid enrollees must, in most circumstances, seek medical treatment from providers who belong to these provider networks (affiliated providers). The record reflects that for the past five years Midwest has provided emergency medical services to Harmony Health's enrollees. During that time period, Midwest was not a part of Harmony Health's managed care networks and had not negotiated any rates of reimbursement for emergency medical services with Harmony Health. Harmony Health reimbursed Midwest, a nonaffiliated provider,[3] at the same rates of reimbursement as set by HFS in the Medicaid fee-for-service program.
Midwest commenced a putative class action lawsuit against Harmony Health, seeking to recover the difference between its billed charges and the reimbursement amounts actually paid by Harmony Health over the five-year period preceding the lawsuit. Midwest based its complaint on theories of quantum meruit, unjust enrichment and the State Prompt Payment Act. 30 ILCS 540/0.01 et seq. (West 2006).
In response, Harmony Health filed motions to dismiss under sections 2-619 and 2-615 of the Illinois Code of Civil Procedure. 735 ILCS 5/2-615, 619(a)(9) (West 2006). Prior to entry of the trial court's order, Harmony Health withdrew its claim for violation of the State Prompt Payment Act. On December 12, 2006, the trial court entered an order granting dismissal under section 2-619 and denying Harmony Health's section 2-615 motions. Midwest timely appealed the trial court's order granting dismissal under section 2-619; Harmony Health timely appealed the denial of its section 2-615 motions to dismiss.

OPINION
On appeal, Midwest contends that the trial court erred in granting Harmony Health's section 2-619 motions to dismiss on the grounds that Midwest's claims were *699 barred by its HFS provider agreements and Harmony Health's MCO agreements.
The standard of review of a motion to dismiss pursuant to section 2-619 is de novo. LaSalle National Bank v. City Suites, Inc., 325 Ill.App.3d 780, 789, 259 Ill.Dec. 259, 758 N.E.2d 382, 389 (2001). A section 2-619 motion admits the legal sufficiency of the complaint but raises defects, defenses or other affirmative matter that defeats the plaintiff's complaint. LaSalle National Bank v. City Suites, Inc., 325 Ill.App.3d at 789, 259 Ill.Dec. 259, 758 N.E.2d at 389. The phrase "affirmative matter" is defined as "something in the nature of a defense that negates the cause of action completely or refutes crucial conclusions of law or conclusions of material fact contained in or inferred from the complaint." Glisson v. City of Marion, 188 Ill.2d 211, 220, 242 Ill.Dec. 79, 720 N.E.2d 1034, 1039 (1999).
Under Illinois law, MCOs are required to reimburse medical claims according to their contracts, as well as the Illinois Public Aid Code (305 ILCS 5/1-2 et seq. (West 2006)), the Illinois Administrative Code (89 Ill. Adm. Code § 140.12(i)(1)), amended at 31 Ill. Reg. 8485 (eff. May 30, 2007), the rules and regulations promulgated by HFS, and all applicable federal regulations governing the Medicaid Program. United States ex rel. Batty v. Amerigroup Illinois, Inc., 528 F.Supp.2d 861, 866-67 (N.D.Ill. 2007). In reviewing Harmony Health's section 2-619 motions, we consider how these various authorities govern the relationship, rights, and obligations of the two parties in this case.
Harmony Health's enrollees are normally restricted to affiliated providers with whom Harmony Health has previously negotiated service reimbursement rates. Had Harmony Health and Midwest entered into an express contract with each other regarding the provision of medical services to Harmony Health's enrollees, we would look to the terms of that contract first to decide this dispute. See Chicago Hospital Risk Pooling Program v. Illinois State Medical Inter-Insurance Exchange, 325 Ill.App.3d 970, 259 Ill.Dec. 230, 758 N.E.2d 353 (2001) (holding that plaintiff, a self-insurance risk-pooling trust, could not state claims for unjust enrichment or quantum meruit where express agreement governed the parties' relationship in allocating liability). Here, however, Harmony Heath and Midwest did not have a contract for a particular rate of reimbursement for medical services at the time Midwest provided emergency medical services to Harmony Health's enrollees. Midwest argues that because the parties never entered into an express contract governing reimbursement of such services, Harmony Health may not unilaterally determine the reimbursement rates for the services Midwest provided. Midwest is mistaken.
The propriety of Harmony Health's reimbursement determination cannot be gauged solely by considering the relationship of the two parties; rather, we must consider the question in the broader context of the Medicaid program. This program establishes "a system of federal funding of state plans to furnish health care to needy persons through agreements with private and public individuals and institutions capable of providing those services." Troutman v. Cohen, 588 F.Supp. 590, 591-92 (E.D.Pa.1984).
In Illinois, healthcare providers are statutorily required to provide emergency medical services to any individual whose life would be threatened in the absence of such treatment, regardless of that individual's inability to pay for such services. See 210 ILCS 70/1 (West 2006). In some instances the law effectively imposes an unfunded mandate on emergency healthcare providers. Providers may bill a patient *700 directly, but as Harmony Health notes, the likelihood of collecting from a Medicaid-eligible (i.e., indigent) patient is remote.
The Medicaid program offers some relief. Emergency service providers that enter into an agreement with HFS to participate in the Medicaid program can bill HFS at the HFS fee-for-service rate after treating a Medicaid beneficiary, but only by virtue of having previously entered into an HFS provider agreement. Likewise, emergency service providers who treat a Medicaid beneficiary enrolled in an MCO can bill the MCO for reimbursement, but, again, only if the provider previously entered into an HFS provider agreement. HFS provider agreements do not guarantee that emergency care providers can recover their full billed amount for services rendered to a Medicaid enrollee. Rather, provider agreements explicitly provide that "[t]he Provider shall receive payment based on [HFS's] reimbursement rate which shall constitute payment in full."
Midwest relies on a Pennsylvania case, Citizens' Ambulance Service Inc. v. Gateway Health Plan, 806 A.2d 443, 447 & n. 4 (Pa.Super.2002), to support its proposition that HFS provider agreements only limit reimbursement from the state to the provider in the fee-for-service program, but do not apply to reimbursement payments made by an MCO in the state's managed care program.
Midwest's assertion fails to contemplate the full scope of Illinois's Medicaid program. We agree that nothing in the HFS provider agreements limit a healthcare provider, like Midwest, from privately negotiating reimbursement rates with MCOs that differ from the HFS fee-for-service rate. We also agree that HFS provider agreements do not govern the rate of reimbursement that MCOs are obligated to pay providers who treat an MCO's enrollee for an emergency medical condition but who are not part of the MCO's approved provider network. But HFS provider agreements are the legal instruments that create any right on the part of emergency healthcare providers to seek reimbursement from an MCO when such providers are not part of the MCO's network; likewise, MCO agreements with HFS are the legal instrument that create any obligation on the part of MCOs to reimburse non-network-affiliated emergency healthcare providers that treat one of the MCOs Medicaid enrollees. We look at those agreements in tandem to determine the scope of the MCO's obligation in emergency care situations.

Harmony Health's MCO Agreement with HFS
Section 5.15 of Harmony Health's MCO agreement with HFS provides that "[Harmony Health] shall pay for all Emergency Services * * * rendered by a non-Affiliated Provider * * * at the same rate [HFS] would pay for such services, unless a different rate was agreed upon." (Emphasis added). Contrary to Midwest's assertion, this section unambiguously forecloses Midwest's argument that Midwest is entitled to full reimbursement for the services it provided to Harmony Health's enrollees. While section 5.15 certainly enables an emergency care provider to privately negotiate a reimbursement rate higher than the HFS fee-for-service rate, it clearly limits reimbursement to the HFS fee-for-service rate "unless a different rate was agreed upon." Harmony Health and Midwest never privately agreed upon a particular reimbursement rate, a point that Midwest concedes; thus, Harmony Health was required by its MCO agreement to reimburse Midwest at the HFS fee-for-service rate.


*701 Medicaid Program Agreement
The structure of Medicaid creates rights and obligations between the federal government, state agencies, MCOs and healthcare providers through various agreements. Midwest has repeatedly asserted that although it has no direct contract with Harmony Health concerning the provision of emergency services, its claims arise in quasi-contract. Specifically, Harmony Health bases its claims on the equitable theories of either unjust enrichment or quantum meruit or both. Both legal theories are based on a contract implied in law and apply where one party performs a service for another's benefit, the benefiting party accepts the benefit, and the circumstances surrounding the agreement indicate that the service was not intended to be gratuitous. Village of Clarendon Hills v. Mulder, 278 Ill.App.3d 727, 215 Ill.Dec. 424, 663 N.E.2d 435 (1996).
Harmony Health's obligations under the Medicaid Program run principally to HFS. When Harmony Health reimburses a nonaffiliated provider for emergency medical services provided to its enrollees at the HFS fee-for-service rate, it does so pursuant to section 5.15 of its MCO agreement with HFS. No quasi-contractual relationship exists between Harmony Health and Midwest that requires a different result; these parties are only in contract with each other by virtue of their separate contracts with HFS as participants in the Medicaid program. To the extent that Midwest voluntarily elected to participate in the Medicaid program, and the Medicaid program prescribes certain reimbursement rates, Midwest cannot allege that Harmony Health has retained a benefit unjustly.
Midwest relies on two principle cases to support its proposition that "an MCO subject to an at-risk agreement to underwrite Medicaid benefits may not unilaterally impose reimbursement rates on providers in the same manner that states may impose such reimbursement rates within fee-for service Medicaid." Michael Reese Hospital and Medical Center v. Chicago HMO, Ltd., 196 Ill.App.3d 832, 143 Ill.Dec. 537, 554 N.E.2d 472 (1990); River Park Hospital, Inc. v. BlueCross BlueShield of Tennessee, Inc., 173 S.W.3d 43 (Tenn.App. 2002). In these cases relief was granted on a quasi-contractual basis. These cases do not change our analysis, however, because neither court analyzed the terms that appear in Harmony Health's MCO agreement with HFS.
We conclude that the trial court correctly determined that the appropriate rate of reimbursement for a nonaffiliated provider that provides emergency medical services to an MCO's Medicaid enrollee is the HFS fee-for-service rate. Since the HFS provider agreements and MCO agreements prescribe this result, we need not determine which party's argument is more consistent with the Medicaid program's policy goals.
We do, however, find Harmony Health's argument that a different result would defeat the purpose of Illinois's managed care program altogether particularly compelling. Managed care risks extinguishment if all nonaffiliated emergency healthcare providers are entitled, under theories of quantum meruit and unjust enrichment, to full reimbursement for services provided to a managed care organization's enrollees. If Midwest prevailed, providers would have little to no incentive to privately negotiate reimbursement rates with such managed care organizations. Illinois implemented a managed care program as a method of containing the escalating costs of providing medical care to Medicaid recipients. 305 ILCS 5/5-15 (West 2006). We can only speculate that absent a managed care component, needy individuals who might otherwise be served by Illinois's *702 Medicaid program will fall through the cracks.
In light of our decision, we need not reach Harmony Health's assertion on cross-appeal that Midwest failed to state a claim for either quantum meruit or unjust enrichment.
For all of the reasons stated above, we affirm the judgment of the trial court.
Affirmed.
NEVILLE, P.J., and MURPHY, J., concur.
NOTES
[1]  United filed its own brief on appeal; Harmony and Amerigroup filed a joint brief on appeal.
[2]  Prior to oral arguments, the parties filed an agreed motion to dismiss Defendant-Appellee, United Health Care of Illinois, Inc., from this appeal. We now grant said motion.
[3]  Hereafter "nonaffiliated provider" refers to a healthcare provider that is not part of an MCO's network and has not otherwise negotiated with an MCO for a particular rate of reimbursement for the provision of emergency services. Harmony Health has made private agreements that solely concern reimbursement of emergency medical services with healthcare providers that are not part of its networks.
