Thege consolidated actions were brought to challe the constitutionality of a Minnegota gtatute wbich; as a condition of par. tid tíon in the state>8 Medicaid program, limitg the rateg nursi homeg charge regidentg who do not receive Btate medical agsigtance benefits, and retroactively mandates restitution to such residents of charges that exceeded a specified rate differential based on the rates approved by the state for medical assistance recipients, We affirmed the denial of a preliminary injunction, Minnesota Association of Health Care Facilities, Inc. v. Minnesota Department of Public Welfare, 602 F.2d 150 (8th Cir.1979), and following trial by consent before a magistrate, the district court entered judgment for the defendants,
jn jq0 83-2446, Minnesota Association of Health Care Facilities, Inc. (MAHCF) and the individual plaintiffs contend that the statute violates due process and equal protection guarantees, deprives them of property without iust compensation, and unconstitutionally impairs the obligation of contracts- In No- 83-2447> Minnesota Hospital Association (MHA) and the individual plaintiffs challenge only the retroactive “payback Provision” of the statute as an unconstitutional impairment of contracts. We hold unconstitutional the part of the statute which retroactively requires refund of collected charges, but reject the remaining constitutional challenges.
I. Background
The federal Medicaid program authorizes grants to the states to help fund medical assistance programs and specifies requirements for the administration of the state *445programs. Social Security Act, Title XIX, §§ 1901-1917, 42 U.S.C. §§ 1396-1396p. The Minnesota Department of Public Welfare administers the Minnesota state plan for medical assistance. A system of reimbursement to nursing homes for their care of medical assistance recipients is established by departmental regulations. See Minnesota Rules, ch. 9510 (1983) (formerly 12 Minn.Code Agency R. § 2.049). The regulations specify criteria for prospective determination of the per diem reimbursement rate to a nursing home for each resident in its care receiving medical assistance. In this appeal the plaintiffs do not challenge these regulations.
If a nursing home chooses to participate in the Medicaid program it must comply with conditions established by Minn.Stat. § 256B.48. On April 13,1976, the Minnesota legislature approved the following pertinent language:
Subdivision 1. No nursing home shall be eligible to receive medical assistance payments unless it agrees in writing that it will refrain from:
(a) Charging nonmedical assistance residents rates for similar services which exceed by more than ten percent those rates which are approved by the state agency for medical assistance recipients; effective July 1, 1978, no nursing home shall be eligible for medical assistance if it charges nonmedical assistance recipients rates for similar services which exceed those which are approved by the state agency for medical assistance recipients; provided, however, that the nursing home may (1) charge nonmedical assistance residents a higher rate for a private room, and (2) charge for special services which are not included in the daily rate if medical assistance patients are charged separately at the same rate for the same services in addition to the daily rate paid by the state agency;
Minn.Stat. § 256B.48 (1976) (amended 1977, 1978, 1983).
The magistrate found that following enactment of this provision consumers complained that some nursing homes raised to the statutory limit the rates charged residents not receiving state medical assistance. In 1977, the legislature amended section 256B.48 by adding the underlined language below:
(a) Charging nonmedical assistance residents rates for similar services which exceed by more than ten percent those rates which are approved by the state agency for medical assistance recipients. For nursing homes charging nonmedical assistance residents rates less than ten percent more than those rates which are approved by the state agency for medical assistance recipients, the maximum differential in rates between nonmedical assistance residents and medical assistance recipients shall not exceed that differential which was in effect on April 13, 1976. If a nursing home has exceeded this differential since April 13, 1976, it shall return the amount collected in excess of the allowable differential stated by this subdivision to the nonmedical assistance resident, or that person’s representative, by July 1, 1977. Effective July 1, 1978, no nursing home shall be eligible * * *.
Minn.Stat. § 256B.48(l)(a) (1977) (amended 1978, 1983).
II. Due Process
MAHCF contends that by limiting the rates charged to residents not receiving medical assistance, the statute, in combination with an already inadequate level of reimbursement provided nursing homes under state regulations for their care of medical assistance recipients, deprives Minnesota nursing homes of substantive due process and results in a taking of their property without just compensation in violation of the Fifth and Fourteenth Amendments. Although MAHCF now also maintains that the statute contravenes similar provisions of the Minnesota Constitution, these state constitutional claims were not advanced in MAHCF's second amended complaint and we do not consider them on appeal.
*446With respect to the claim of an uncompensated taking, MAHCF urges that we examine the scheme of reimbursement under the principles enunciated in cases dealing with the regulation of rates charged by public utilities:
Rates which are not sufficient to yield a reasonable return on the value of the property used at the time it is being used to render the service are unjust, unreasonable and confiscatory, and their enforcement deprives the public utility company of its property in violation of the Fourteenth Amendment.
Bluefield Water Works & Improvement Co. v. Public Service Commission, 262 U.S. 679, 690, 43 S.Ct. 675, 678, 67 L.Ed. 1176 (1923). The extent of state regulation of the standards of operation for nursing homes and of the rates charged by them are cited by MAHCF as reasons for treating public utilities and nursing homes similarly with respect to state rate regulation.
Cases concerning public utilities are inapposite, however, because the present case simply does not involve a forced taking of property by the state. Minnesota nursing homes, unlike public utilities, have freedom to decide whether to remain in business and thus subject themselves voluntarily to the limits imposed by Minnesota on the return they obtain from investment of their assets in nursing home operation. Cf. Permian Basin Area Rate Cases, 390 U.S. 747, 772-73, 88 S.Ct. 1344, 1362-63, 20 L.Ed.2d 312 (1968) (in examination of area maximum rates it was pertinent that abandonment of unprofitable activities may be permitted). Moreover, the state does not require that nursing homes admit medical assistance residents and participate in the Medicaid program. It is, of course, only through voluntary participation in the state’s Medicaid program that a nursing home falls within the purview of section 256B.48(l)(a). “If appellants find that the reimbursement rates are insufficient, then they may either make their homes more efficient and economical or terminate their relationship with Medicaid and no longer accept Medicaid recipients as residents.” Minnesota Association of Health Care Facilities, Inc. v. Minnesota Department of Public Welfare, supra, 602 F.2d at 154. MAHCF contends that business realities prevent nursing homes from leaving the Medicaid program voluntarily. Despite the strong financial inducement to participate in Medicaid, a nursing home’s decision to do so is nonetheless voluntary. This voluntariness forecloses the possibility that the statute could result in an imposed taking of private property which would give rise to the constitutional right of just compensation, and thus it is unnecessary in this case to employ the adequacy standards applicable to state regulation of public utility rates.
MAHCF argues that even if participation in the Medicaid program is voluntary, the statute impermissibly conditions such participation on the relinquishment by nursing homes of constitutional rights. To be sure, a state may not condition the grant of a privilege or benefit upon the surrender of a constitutional right. See Western & Southern Life Insurance Co. v. State Board of Equalization, 451 U.S. 648, 657-58, 664-65, 101 S.Ct. 2070, 2080-81, 68 L.Ed.2d 514 (1981); Sherbert v. Verner, 374 U.S. 398, 404-05, 83 S.Ct. 1790, 1794-95, 10 L.Ed.2d 965 (1963); Frost & Frost Trucking Co. v. Railroad Commission, 271 U.S. 583, 592-93, 46 S.Ct. 605, 606-07, 70 L.Ed. 1101 (1926). In the present case the privilege or benefit involved is participation in the Medicaid program, with consequent reimbursement for care of medical assistance residents. As a condition of participation the state requires that a nursing home agree to abide by the statutory provisions concerning rates charged residents who do not receive medical assistance. Hence, as we examine the constitutionality of the statute we will consider whether compliance with the statutory regulation of rates, imposed as a condition of Medicaid participation, compels the relinquishment of constitutional rights that nursing homes would otherwise have.
We begin by observing that nursing homes that serve medical assistance recipi*447ents have no constitutional right to be free from state controls on the rates they charge residents who do not receive medical assistance. “The Constitution does not guarantee the unrestricted privilege to engage in a business or to conduct it as one pleases. * * * [T]he right to conduct a business, or to pursue a calling, may be conditioned.” Nebbia v. New York, 291 U.S. 502, 527-28, 54 S.Ct. 505, 511-12, 78 L.Ed. 940 (1934) (footnote omitted). Just as in Nebbia the state was permitted to regulate the price of milk, in the present case Minnesota may regulate the rates charged by nursing homes so long as the regulation does not violate constitutional restraints. See id. at 525, 54 S.Ct. at 510.
Notwithstanding MAHCF’s argument to the contrary, we believe the statute meets substantive due process requirements. “If the laws passed are seen to have a reasonable relation to a proper legislative purpose, and are neither arbitrary nor discriminatory, the requirements of due process are satisfied, and judicial determination to that effect renders a court functus officio.” Nebbia v. New York, supra, 291 U.S. at 537, 54 S.Ct. at 516; see North Dakota State Board of Pharmacy v. Snyder’s Drug Stores, Inc., 414 U.S. 156, 164-67, 94 S.Ct. 407, 412-14, 38 L.Ed.2d 379 (1973); Ferguson v. Skrupa, 372 U.S. 726, 728-32, 83 S.Ct. 1028, 1029-32, 10 L.Ed.2d 93 (1963); Williamson v. Lee Optical Co., 348 U.S. 483, 488, 75 S.Ct. 461, 464, 99 L.Ed. 563 (1955). The Minnesota legislature could reasonably find that differences in rates for the same nursing home services, depending wholly upon whether or not a resident receives medical assistance, are inimical to the public welfare, and thus it could properly choose to regulate the rates that nursing homes participating in Medicaid charge to residents who do not receive medical assistance. The statute enacted to achieve this purpose has a rational relationship to the end sought and is not arbitrary or impermissibly discriminatory. Because the statutory rate limitations survive substantive due process scrutiny, nursing homes are not required to relinquish the constitutional right to due process as a condition of participation in the Medicaid program.
III. Equal Protection
MAHCF also contends that the statute violates equal protection because only those nursing homes that participate in the Medicaid program are subject to the restrictions imposed by the statute on the rates charged to residents who do not receive medical assistance benefits. The statute does not apply to nursing homes that have no residents who are Medicaid recipients. Nor does it require a similar equalization of rates for other providers of health care that serve recipients of medical assistance benefits; i.e., hospitals, pharmacies, laboratories, boarding care facilities, and facilities for the mentally retarded. Because it regulates the rates of nursing homes that participate in Medicaid, but not the rates and charges of other nursing homes and health care providers, MAHCF maintains that the statute establishes classifications that are impermissible under the equal protection guarantees of the United States Constitution and the Minnesota Constitution. Once again, however, MAHCF’s state constitutional claim was not raised in the pleadings below and thus our discussion of its equal protection challenge to the statute will be limited to those principles enunciated under the Fourteenth Amendment.
The statute under attack involves economic regulation, and the parties agree that the applicable equal protection standard of review is the rational basis test. The pertinent constitutional principles are well-established and may be briefly stated. The rational basis test “require[s] only that the classification challenged be rationally related to a legitimate state interest.” New Orleans v. Dukes, 427 U.S. 297, 303, 96 S.Ct. 2513, 2515, 49 L.Ed.2d 511 (1976); see Minnesota v. Clover Leaf Creamery Co., 449 U.S. 456, 461-63, 101 S.Ct. 715, 722-23, 66 L.Ed.2d 659 (1981); Vance v. Bradley, 440 U.S. 93, 97, 99 S.Ct. 939, 942, 59 L.Ed.2d 171 (1979). In addition, “ration*448al distinctions may be made with substantially less than mathematical exactitude.” New Orleans v. Dukes, supra, 427 U.S. at 303, 96 S.Ct. at 2517. Consistent with equal protection principles, a legislature may deal with a problem one step at a time, addressing that part of the problem which seems most serious, see id.; Williamson v. Lee Optical Co., supra, 348 U.S. at 489, 75 S.Ct. at 465; or it may select but one phase of a field of business activity for regulation while neglecting the others. Id. The question before us is whether upon examination the statute meets these established standards of equal protection review.
As we have observed, the statute promotes a legitimate state interest in controlling the rates that nursing homes participating in Medicaid charge residents who do not receive medical assistance. More specifically, the magistrate found that the statute (1) reduces discrimination against Medicaid recipients in gaining entry to nursing homes by eliminating the incentive to discriminate; (2) alleviates the stigma attached to receiving welfare benefits; (3) permits private pay residents to stretch their savings farther and thus stay off of welfare; (4) promotes the fundamental notion of fairness that one should pay equal rates for the same services; and (5) eases the resentment of Medicaid recipients by residents who do not receive medical assistance. MAHCF contends that the distinctions made by the statute are invalid because these purposes would also have been furthered by regulating the rates charged by nursing homes that do not participate in Medicaid, and by imposing on all health care providers who participate in Medicaid the restriction that charges to consumers not receiving medical assistance cannot exceed the charges allowed for Medicaid recipients. According to MAHCF there was no rational basis for limiting the application of the statute to nursing homes participating in Medicaid since the reasons for the statute apply to other health care providers as well.
As for the classifications resulting from the statute, the legislature could rationally have believed that the problems arising from rate discrepancies were most serious in nursing homes that participate in Medicaid, and that it was not necessary or desirable to regulate the rates of other nursing homes or to impose a similar equalization requirement on other health care providers who participate in Medicaid. The rates nursing homes charge Medicaid recipients are limited by the state reimbursement formula, but absent regulation a nursing home could charge residents not receiving medical assistance higher rates in order to achieve a desired level of revenue. Residents who did not receive a state subsidy would thus contribute disproportionately to the home’s income. The state could properly move to remedy what it perceived as unfairness in such disproportionate charges for the same services. It was only necessary to include nursing homes that participate in Medicaid within the purview of the remedial measure, however, since this kind of rate discrepancy presumably would not exist in nursing homes occupied only by residents not receiving medical assistance. The legislature could also have rationally concluded that because of differences in the nature and cost of services provided, discrepancies in charges by nursing homes participating in Medicaid presented a greater possibility of economic and personal harm to consumers than would similar discrepancies in the charges of other health care providers, apart from nursing homes, that participate in Medicaid. Minnesota was not forbidden to deal with the issue of health care costs by attacking but part of the problem. “[I]n the local economic sphere, it is only the invidious discrimination, the wholly arbitrary act, which cannot stand consistently with the Fourteenth Amendment.” New Orleans v. Dukes, supra, 427 U.S. at 303-04, 96 S.Ct. at 2517. The classifications established by the Minnesota statute are neither invidious nor arbitrary, and hence not violative of equal protection.
IV. Impairment of Contracts
We now turn to the question of whether, by making compliance with its terms a *449condition of Medicaid participation, section 256B.48(l)(a) impairs the obligation of contracts in violation of article I, section 10 of the United States Constitution. MAHCF challenges as an unconstitutional impairment of contracts all statutory restrictions imposed on rates charged by nursing homes to residents not receiving medical assistance, while MAHCF challenges only that part of the statute which requires restitution of amounts exceeding the allowable rate differential established retroactively by the statute. Our discussion will be limited to private contracts between residents and nursing homes. Although MAHCF also contends that the statute unconstitutionally impairs basic provider agreements between the state and individual nursing homes by requiring them to sign supplemental provider agreements incorporating the terms of section 256B.48(l)(a) as a condition of participation in the Medicaid program, we do not consider this contention because we have not been furnished any example of the basic agreements that it is argued are impaired.
As we consider whether the statute impermissibly impairs contracts between nursing homes and their residents, we will, for the time being, put aside consideration of the retroactive restitution requirement and deal with MAHCF’s challenge to the remaining rate limitations of the statute. The gist of MAHCF’s argument is that by placing limits on rates that nursing homes may charge residents who do not receive medical assistance, the statute alters the terms of agreements reached by private parties. From the briefs and record it appears that some of these agreements include a specified rate for services, and thus a new agreement would be required if the rate were to be changed. Other agreements specify a given rate, but also include provisions that allow the nursing home to change the rate without entering into a new contract. While the statute would limit the collection of rates specifically established by agreements in existence before the statute became effective, if above the statutory maximum, it is clear from MAHCF’s reply brief that the nursing homes’ principal concern is the limitation that the statute places on their contractually authorized periodic adjustment of rates. MAHCF contends that when the contracts were signed it was not contemplated that such rate adjustment would be subject to limitation by the state.
In numerous cases the Supreme Court has articulated principles applicable to analysis of state laws under the contract clause. Although the language of the contract clause is unequivocal, the limitation it imposes is “not an absolute one and is not to be read with literal exactness like a mathematical formula.” Home Building & Loan Association v. Blaisdell, 290 U.S. 398, 428, 54 S.Ct. 231, 236, 78 L.Ed. 413 (1934). It has long been recognized that the prohibition of laws impairing the obligation of contracts does not prevent states from acting pursuant to their inherent police power to promote the public welfare. See Energy Reserves Group Inc. v. Kansas Power & Light Co., 459 U.S. 400, 410, 103 S.Ct. 697, 704, 74 L.Ed.2d 569 (1983); Allied Structural Steel Co. v. Spannaus, 438 U.S. 234, 241, 98 S.Ct. 2716, 2720, 57 L.Ed.2d 727 (1978); United States Trust Co. v. New Jersey, 431 U.S. 1, 21-22, 97 S.Ct. 1505, 1517-1518, 52 L.Ed.2d 92 (1977); Blaisdell, supra, 290 U.S. at 434-35, 54 S.Ct. at 238; Manigault v. Springs, 199 U.S. 473, 480, 26 S.Ct. 127, 130, 50 L.Ed. 274 (1905). If the states did not have this power to enact general regulatory measures, despite their impairment or destruction of private contracts, it would be possible “to obtain immunity from state regulation by making private contractual arrangements.” United States Trust Co., supra, 431 U.S. at 22, 97 S.Ct. at 1517. “One whose rights, such as they are, are subject to state restriction, cannot remove them from the power of the State by making a contract about them.” Hudson Water Co. v. McCarter, 209 U.S. 349, 357, 28 S.Ct. 529, 531, 52 L.Ed. 828 (1908). We have already decided that consistent with due process and equal protection the rates charged by nursing homes that participate in the Medicaid program may be regulated *450by the state, and thus we now consider whether this exercise of the police power effects an unconstitutional impairment of contracts.
The first step in the constitutional analysis is to determine “whether the state law has, in fact, operated as a substantial impairment of a contractual relationship.” Allied Structural Steel Co., supra, 438 U.S. at 244, 98 S.Ct. at 2722, quoted in Energy Reserves Group, supra, 459 U.S. at 411, 103 S.Ct. at 704. The more severe the impairment of contract worked by the law, the greater the level of scrutiny given it. Energy Reserves Group, supra, 459 U.S. at 411, 103 S.Ct. at 704; Allied Structural Steel Co., supra, 438 U.S. at 245, 98 S.Ct. at 2722. Substantial impairment may result even though there is no total destruction of contractual expectations. Energy Reserves Group, supra, 459 U.S. at 411, 103 S.Ct. at 704; United States Trust Co., supra, 431 U.S. at 26-27, 97 S.Ct. at 1519-1520. One consideration in determining whether the impairment is substantial is the extent to which reasonable expectations under the contract are disrupted. See Energy Reserves Group, supra, 459 U.S. at 411, 103 S.Ct. at 704; Allied Structural Steel Co., supra, 438 U.S. at 245-47, 98 S.Ct. at 2722-23; United States Trust Co., supra, 431 U.S. at 31, 97 S.Ct. at 1522; El Paso v. Simmons, 379 U.S. 497, 515, 85 S.Ct. 577, 587, 13 L.Ed.2d 446 (1965).
If the law causes a substantial impairment the inquiry moves to the state’s justification for its action. See Energy Reserves Group, supra, 459 U.S. at 411, 103 S.Ct. at 704. Regulation of existing contractual relationships must serve a significant and legitimate public purpose. See id.; United States Trust Co., supra, 431 U.S. at 22, 97 S.Ct. at 1517; Blaisdell, supra, 290 U.S. at 444-45, 54 S.Ct. at 242-43. “The requirement of a legitimate public purpose guarantees that the State is exercising its police power, rather than providing a benefit to special interests.” Energy Reserves Group, supra, 459 U.S. at 412, 103 S.Ct. at 705. Thus the Court has considered whether the impairment serves to remedy “an important general social problem,” Allied Structural Steel Co., supra, 438 U.S. at 247, 98 S.Ct. at 2724, or “to protect a broad societal interest rather than a narrow class.” Id. at 249, 98 S.Ct. at 2724. In Blaisdell, supra, the Court noted that the law it upheld “was not for the mere advantage of particular individuals but for the protection of a basic interest of society.” 290 U.S. at 445, 54 S.Ct. at 242. Ultimately, it must be determined whether the means chosen to achieve the legitimate public purpose survives constitutional scrutiny. “Legislation adjusting the rights and responsibilities of contracting parties must be upon reasonable conditions and of a character appropriate to the public purpose justifying its adoption.” United States Trust Co., supra, 431 U.S. at 22, 97 S.Ct. at 1518, citing Blaisdell, supra, 290 U.S. at 445-47, 54 S.Ct. at 242-43. Deference is given to the legislative judgment concerning the necessity and reasonableness of economic and social regulation which affects private contracts. See Energy Reserves Group, supra, 459 U.S. at 412-13, 103 S.Ct. at 705-06; United States Trust Co., supra, 431 U.S. at 22-23, 97 S.Ct. at 1517-1518.
When we apply these principles to section 256B.48(l)(a), we conclude that those provisions of the statute which have prospective application are constitutional. We believe that consistent with the contract clause Minnesota could limit the differential between rates for residents receiving medical assistance and those not receiving it to 10 percent or to the differential in effect on April 13, 1976, and that after July 1, 1978, the state could equalize the rates for these two categories of nursing home residents. Initially, we doubt that the law causes a substantial impairment of contractual relationships. Nursing homes could not reasonably expect that the terms of whatever contracts they had with their residents would exempt them from rate regulation by the state. As we have noted, MAHCF is chiefly concerned with the statutory limitations on the freedom of nursing homes periodically to increase their *451rates by amounts not specified in resident contracts. It is unlikely that this limitation of rate increases would substantially impair reasonable, settled contractual expectations. Even if the impairment is substantial, however, the state’s interest in controlling rates charged by nursing homes provides a legitimate public purpose for the statute. Without the statute nursing homes could charge residents not receiving medical assistance higher rates in order to compensate for what they consider to be inadequate Medicaid reimbursement. In view of the state’s objective of providing adequate compensation to prudently managed nursing homes, see Minnesota Rules, supra, § 9510.0020, the legislature could prohibit nursing homes from making unsubsidized residents bear the burden of inefficient nursing home operation. Legitimate exercise of the police power includes ensuring that state efforts to assist some nursing home residents do not work to the detriment of other residents. In addition, the class of persons benefitted by the statute is certainly not so narrow that it may be deemed special interest legislation. The statute truly deals with an important general social problem and serves to protect a basic interest of society. Finally, particularly in view of the gradual implementation of the rate limitations, we cannot say that the adjustment of contract rights effected by the statute involves unreasonable conditions or is inappropriate to the public purpose it serves.
We now return to the question of whether an unconstitutional impairment of contracts results from that part of the statute which retroactively requires restitution of charges in excess of the differential in effect April 13, 1976. We believe that it does. This aspect of the statute does cause substantia] impairment of contractual relationships, for the rates charged were not unlawful at the time they were collected, and nursing homes could reasonably have expected that pursuant to agreements with their residents they were entitled to these funds. We will assume that the state’s interest in controlling rates charged by nursing homes participating in Medicaid provided a legitimate public purpose for the restitution provision, although it does appear that this part of the statute has a considerably narrower focus than do other parts. Ultimately, however, we believe the adjustment of contract rights made by the retroactive part of the statute is not upon reasonable conditions or of a character appropriate to the public purpose identified. Because of its retroactivity, the statute imposes totally unexpected liability on nursing homes for charges that were permitted by law when collected. This statute goes too far because it disrupts settled and completed financial arrangements under contracts made in reliance on existing law. The retroactive payback provision is invalid.
Affirmed in part and reversed in part.