
16 Cal.2d 276 (1940)
COUNTY OF ALAMEDA, Petitioner,
v.
GEORGE A. JANSSEN, as Chairman of Board of Supervisors, etc., Respondent.
S. F. No. 16435. 
Supreme Court of California. In Bank.  
October 2, 1940.
 Ralph E. Hoyt, District Attorney of Alameda County, J. F. Coakley, Chief Assistant District Attorney, Robert H. McCreary, Assistant District Attorney, Lawrence S. Fletcher, Deputy District Attorney, for Petitioner.
 J. H. O'Connor, County Counsel (Los Angeles), and L. K. Vobayda and Gerald G. Kelly, Deputy County Counsel, as Amici Curiae, on Behalf of Petitioner.
 Landels, Weigel & Crocker for Respondent.
 TRAYNOR, J.
 By this proceeding in mandamus the petitioner seeks to compel the respondent, as chairman of the Board of Supervisors of the County of Alameda, to sign and execute certain releases of liens and to cancel a restrictive agreement with respect to the real properties of the recipients of financial aid granted under the provisions of the Old Age Security Act. Respondent has generally demurred.
 In 1929 the legislature enacted the Old Age Security Act (Stats. 1929, chap. 530, p. 914) which provided for financial assistance to the needy aged who met certain requirements and whose property did not exceed specified values. In 1935 section 4 of the act was amended (Stats. 1935, p. 1769) to provide for a lien against the real property of a recipient as security for the aid which he received. In 1937 the legislature amended sections 2224 and 2225 of the Welfare and Institutions Code, into which section 4 of the Old Age Security Act had been incorporated, to eliminate the provisions for *279 such liens as well as the provisions making the aid a debt of the recipient to the state and county.
 At the same time section 2225 was amended to provide that "all liens and mortgages heretofore created under the provisions of this chapter are hereby released and the board of supervisors of each county is hereby directed and authorized to execute and record appropriate instruments of release". In County of Los Angeles v. Jessup, 11 Cal.2d 273 [78 PaCal.2d 1131], this provision was held unconstitutional as authorizing a gift of "public money or thing of value" in violation of section 31 of article IV of the Constitution.
 Thereupon the legislature in 1939 adopted section 2227 of the Welfare and Institutions Code (Stats. 1939, chap. 719), which provides in part: "Any lien created by the recording of a notice of aid pursuant to the provisions of Chapter 530 of the Statutes of 1929 as amended by Statutes of 1935, page 1769, may be released by the board of supervisors of the county granting the aid upon payment to the county of the amount of aid repayment of which is thereby secured or upon payment to the county of such amount as in the opinion of the board of supervisors equals the net amount which would be realized in the event that said lien was foreclosed, and any such lien may be subordinated by the board of supervisors of the county granting the aid to the lien of any mortgage or deed of trust given to renew or refinance any mortgage, deed of trust or other encumbrance, the lien or charge of which had priority over such lien. In any case in which the board of supervisors determines, after investigation, that the purposes of this chapter will be served by releasing any such lien in whole or in part by subordinating the same to any encumbrance and determines that the property affected by such lien is at the time owned by the recipient of aid the board of supervisors may after approval by the Department of Social Welfare release such lien in whole or in part or may subordinate the same to one or more designated encumbrances executed by the recipient of aid without consideration or for such consideration as the board shall determine."
 At the same time the legislature added to the code section 2226 which provided in part as follows:
 "If the recipient of aid under this chapter owns or acquires real property or any estate or interest therein the board of supervisors may require him to enter into a written agreement that he will not, during his lifetime, without the consent *280 of the board of supervisors, transfer or encumber such property, which agreement shall specifically describe such property, be acknowledged by the recipient in the same manner as a grant of real property and be recorded in the office of the county recorder of each county wherein such real property or some part thereof lies." and added section 2229 which gave the county not only a claim against the estate of any deceased recipient for reimbursement of aid but also "all the rights of an unsecured creditor against the entire estate of the recipient". (Stats. 1939, chap. 719.) Legislation which became effective February 23, 1940 (Stats. 1940, chap. XI, sec. 5), repealed the provisions for agreements by recipients of aid not to convey or encumber their property, all such agreements being "hereby cancelled and declared to be hereafter of no force and effect". The boards of supervisors were directed to "authorize" by resolution, upon application, the execution and recordation of appropriate instruments of cancellation of any or all of the agreements canceled by this section.
 Pursuant to section 2227, the Board of Supervisors of Alameda County adopted a resolution releasing without consideration a statutory lien previously acquired on certain real property of a recipient of aid, which he still owned, when it found after investigation that the purposes of the Old Age Security Law would be served by giving the release. At the same time the board, pursuant to section 5 of chapter XI of the 1940 Statutes, adopted a resolution canceling and releasing without consideration an agreement not to convey or encumber real property. It likewise adopted a resolution, pursuant to section 2227 of the Welfare and Institutions Code, releasing its lien against certain real property of a recipient of aid held by a third party upon payment to the county of an amount which in the opinion of the board equaled the net amount which would be realized in the event the lien were foreclosed.
 Respondent Geo. A. Janssen, as chairman of the Board of Supervisors of Alameda County, refuses to sign and execute the above-described releases and cancellation on the grounds that section 2227 of the Welfare and Institutions Code violates section 31 of article IV of the California Constitution prohibiting the legislature from making or authorizing any gift of public money or thing of value to any individual, as *281 well as section 25 of article IV of the Constitution prohibiting the passage of any special or local law authorizing the creation, extension or impairment of liens, and constitutes an unconstitutional delegation of legislative authority. He further contends that chapter XI of Statutes of 1940 violates the prohibitions in the United States and California Constitutions against the passage of any law impairing the obligation of contracts.
 [1] Section 31 of article IV of the California Constitution prohibits the legislature from making or authorizing a gift of public money or thing of value to any individual or corporation. The next clause, however, provides that nothing in this section shall prevent the legislature from granting aid pursuant to section 22 of article IV which authorizes the granting of aid to indigent aged. [2] Therefore the release of a lien by a county pursuant to section 2227 of the Welfare Code does not constitute a violation of section 31, article IV, if (1) it is not a gift of public money or thing of value, or (2) it is a grant of aid to indigent aged under section 22 of article IV.
 [3] It is well settled that, in determining whether an appropriation of public funds or property is to be considered a gift, the primary question is whether the funds are to be used for a "public" or a "private" purpose. If they are for a "public purpose", they are not a gift within the meaning of section 31 of article IV. (County of San Diego v. Hammond, 6 Cal.2d 709 [59 PaCal.2d 478]; City of Oakland v. Garrison, 194 Cal. 298 [228 P. 433]; Allied Architects Assn. v. Payne, 192 Cal. 431 [221 P. 209, 30 A.L.R. 1029]; Veterans' Welfare Board v. Riley, 188 Cal. 607 [206 P. 631].) The benefit to the state from an expenditure for a "public purpose" is in the nature of consideration and the funds expended are therefore not a gift even though private persons are benefited therefrom. (Allied Architects Assn. v. Payne, supra.)
 [4] The determination of what constitutes a public purpose is primarily a matter for legislative discretion ( Veterans' Welfare Board v. Riley, supra; Allied Architects Assn. v. Payne, supra; Daggett v. Colgan, 92 Cal. 53 [28 P. 51, 27 Am.St.Rep. 95, 14 L.R.A. 474]), which is not disturbed by the courts so long as it has a reasonable basis. (Nebbia v. New York, 291 U.S. 502 [54 S.Ct. 505, 78 L.Ed. 940]; *282 Powell v. Pennsylvania, 127 U.S. 678 [8 S.Ct. 992, 1257, 32 L.Ed. 253].) This court has frequently upheld the expenditure of funds by the state or its subdivisions for the benefit of individuals as for a "public purpose" and hence not within section 31 of article IV. (MacMillan v. Clarke, 184 Cal. 491 [194 P. 1030, 17 A.L.R. 288] [free school text books]; Veterans' Welfare Board v. Riley, supra [transportation, tuition and living expenses for education of veterans]; Allied Architects Assn. v. Payne, supra [erection of memorial hall for war veterans]; City of Oakland v. Garrison, supra [street improvements]; Patrick v. Riley, 209 Cal. 350 [287 P. 455] [payments for destruction of diseased cattle]; Sacramento & San Joaquin Drainage Dist. v. Riley, 199 Cal. 668 [251 P. 207] [flood control]; City of San Francisco v. Collins, 216 Cal. 187 [13 PaCal.2d 912] [bond issue for relief of indigent sick and poor]; Housing Authority of Los Angeles v. Dockweiler, 14 Cal.2d 437 [94 PaCal.2d 794] [slum clearance]; City of San Diego v. Hammond, supra [use of county funds to pay delinquent assessments on overburdened property]; Goodall v. Brite, 11 Cal.App.2d 540 [54 PaCal.2d 510] [free treatment in county hospital only for those unable to pay]. See 9 Cal. Law Rev. 431; 18 Cal. Law Rev. 697.)
 [5] In the present case the legislature seems clearly justified in its belief that the release of liens held against the property of indigent recipients of aid is for the general public welfare. A person may be indigent even though he is the legal owner of real property and an increase in the benefits to indigent recipients of aid after the right to them has vested is not a gift within the meaning of article IV, section 31. (Home v. Souden, 199 Cal. 508 [250 P. 162]; O'Dea v. Cooke, 176 Cal. 659 [169 P. 366].) The release of a lien which facilitates the sale of property or loans thereon serves the same public purpose of aiding the indigent aged as a direct grant of money. It may remove the necessity for additional direct aid to the owner. The county could not in any event enforce the lien until the death of the recipient and might gain less at that time than it would lose in direct aid to the recipient during his lifetime. By releasing the lien from the recipient's property, the county may relieve the public treasury to the extent that it relieves the recipient.
 [6] Once the board of supervisors has determined, after investigation as required by section 2227 of the Welfare and *283 Institutions Code, that the purpose of the Old Age Security Act is served by the release of a lien upon the property of a recipient of aid, such a release becomes a grant of aid pursuant to section 22 of article IV for the support of indigent aged and therefore within the exception in section 31 of article IV. In the absence of a special statute no liability rests upon an aged person to reimburse the state and county for aid legitimately obtained and granted (Bremer County v. Curtis, 54 Iowa 72 [6 N.W. 135]; Montgomery County v. Gupton, 139 Mo. 303 [39 S.W. 447, 40 S.W. 1094]; Peabody v. Town of Holland, 107 Vt. 237 [178 Atl. 888, 98 A.L.R. 866]; Chester v. Underhill, 16 N. H. 64; Stow v. Sawyer, 85 Mass. 515; In re Dufek's Estate, 164 Minn. 55 [204 N.W. 469]; Spokane Co. v. Arvin, 169 Wash. 349 [13 PaCal.2d 1089]), and there is no provision in section 22 of article IV requiring such liability. [7] The legislature thus has the power to grant aid to indigent aged without imposing any lien upon their property and whenever it does so it supplements direct aid with the benefits which attend freedom from such an encumbrance. If instead it imposes a lien upon the property of recipients of aid which it subsequently releases it merely defers the benefits supplementary to direct aid which it might have conferred at the outset. In either case the benefits serve the same public purpose of aiding the indigent aged.
 The legislation in question differs materially from section 2225 of the Welfare and Institutions Code, held unconstitutional in County of Los Angeles v. Jessup, 11 Cal.2d 273 [78 PaCal.2d 1131]. (12 So. Cal. Law Rev. 310.) Section 2225 authorized the release of statutory liens on property which had passed from the recipient of aid to an heir or grantee and on property of recipients of aid not qualified to receive it. As the section purported to apply to all liens, and its provisions were not separable, it was held invalid as a whole, but the court expressly refrained from passing on the question whether "legislation may constitutionally be framed looking toward the release of such statutory liens as may exist under other classes of typical cases alleged in the petition". The legislation in this case authorizes the release of liens only if the property is still owned by a qualified recipient of aid or, in the event it has passed to another, if the county receives *284 an amount equal to the value which may be realized upon foreclosure of the lien.
 [8] Since the legislature may extend aid to indigent aged by authorizing the release of liens previously acquired upon their property, it may for the same reasons cancel Old Age Security Property Agreements by which recipients of aid agreed not to transfer their real property without consent of local boards of supervisors. Such cancellations in no way violate the provisions of the United States and California Constitutions prohibiting the passage of any law impairing the obligation of contracts. [9] These provisions do not prevent the legislature from changing the contractual rights of its political subdivisions acting in a governmental capacity. (County of Tulare v. City of Dinuba, 188 Cal. 664 [206 P. 983]; City of Trenton v. New Jersey, 262 U.S. 182 [43 S.Ct. 534, 67 L.Ed. 937]; City of Worcester v. Worcester Consol. Street Railway Co., 196 U.S. 539 [25 S.Ct. 327, 49 L.Ed. 591].) As the county boards of supervisors are acting as agents for the state in dispensing old age relief (County of Sacramento v. Chambers, 33 Cal.App. 142 [164 P. 613]; San Francisco v. Collins, 216 Cal. 187 [13 PaCal.2d 912]), there can be no impairment of contracts upon a voluntary relinquishment by the state of any contractual rights it may have acquired. The passing statement in County of Los Angeles v. Jessup, supra, that the legislation there in question was "also constitutionally objectionable because of its impairment of the obligation of contract" was unnecessary to the decision of the case, and upon fuller consideration appears to be without support in the authorities. It must, therefore, be deemed disapproved by our decision herein.
 [10] Respondent's contention that section 2227 is an unlawful delegation of legislative authority to the boards of supervisors is untenable, for that section was passed to serve the purpose of the Old Age Security Act which provides adequate standards for regulating the authority of the boards of supervisors to grant old age relief. An essentially similar contention was adversely answered in Hecke v. Riley, 209 Cal. 767 [290 P. 451].
 [11] Nor does such legislation violate section 25 of article IV prohibiting the legislature from passing any local or special law authorizing the creation, extension or impairment of liens, for the classification of the indigent aged as a group *285 is based upon a clear distinction between them and other individuals in the state, and applies equally to all persons embraced in this class. (See People v. Central Pacific R. R. Co., 105 Cal. 576 [38 P. 905]; City of Pasadena v. Stimson, 91 Cal. 238 [27 P. 604]; Darcy v. City of San Jose, 104 Cal. 642 [38 P. 500]; Chitwood v. Hecke, 219 Cal. 175 [25 PaCal.2d 406].)
 [12] Finally, there can be no constitutional objection to the county's release of its lien upon payment to the county of such amount as in the opinion of the board of supervisors equals the net amount which would be realized in the event the lien were foreclosed, since the county would receive the fair value of the lien as consideration for its release. It must be presumed that in carrying out this section a board of supervisors would not abuse the power conferred upon it of ascertaining value. (Hecke v. Riley, supra.)
 As none of the objections raised by respondent's demurrer is valid, it is ordered that a peremptory writ of mandate issue as prayed.
 Shenk, J., Gibson, C.J., York, J., pro tem., Moore, J., pro tem., and Carter, J., concurred.
