Opinion by
W. D. Porter, J.,
The Acts of April 22, 1850, P. L. 541 and April 16, 1857, P. L. 219, relating to the House of Refuge of the western district of Pennsylvania, now the Morganza Reform School, impose the burden of maintaining the children committed to said institution upon the counties from which such children, respectively, are committed. The Act of April 17, 1869, P. L. 1118, by special favor gave to the county of Lawrence a *318remedy to recover by an action of assumpsit from tbe poor district within which such child had its last legal settlement, or residence, the amount paid for such maintenance at the reform school. That part of the act of 1869 which gave the county of Lawrence a remedy over against the poor district was by the Act of April 28, 1899, P. L. 127, repealed. At the time of the approval of the repealing act of 1899, the county of Lawrence was liable to the reform school for the maintenance of children whose legal settlement was in the poor district of the city of New Castle in the sum of $1,178.88; this action was brought to recover that amount and the above recited facts were agreed upon in the case stated. Can the county of Lawrence maintain an action against the city of New Castle founded upon the provisions of the act of 1869 which had been repealed? When an act of assembly is repealed all proceedings founded upon it which have not ripened into judgment must fall: Commonwealth v. Beatty, 1 Watts, 382; North Canal Street Road, 10 Watts, 351; Fenelon’s Petition, 7 Pa. 173; Hampton v. Commonwealth, 19 Pa. 329; Commonwealth v. Leech, 24 Pa. 55 ; Schenley v. Allegheny, 36 Pa. 29. This principle is subject to the limitation that the repealing act must be within the legitimate scope of the legislative power; it must not impair the obligation of contracts. The legislature cannot impair the obligation of a contract, or pass an ex post facto law, for both these are expressly forbidden. “But an ex post facto law is one which makes an act punishable in a manner in which it was not punishable when it was committed; it relates to penal and criminal proceedings.” “Retrospective laws and state laws divesting vested rights, unless ex post facto or impairing the obligation of contracts, do not fall within the prohibition contained in the constitution of the United States, however repugnant they may be to the principles of sound legislation: ” Grim v. Weissenberg School District, 57 Pa. 433. The contracts which are within the protection of the constitution are those arising from an agreement or understanding immediately between the parties, or out of a course of dealing from which a contract is implied. The claim of Lawrence county is not founded upon a contract, either express or implied. The state without the consent of the county imposed upon the latter the burden of maintaining the prisoners which the tribunals of the county committed *319to the reform school. Without the consent of either the city or the county, the legislature gave to the latter a remedy over against the former. The officers who had authority to make contracts for the county had no voice in determining what children should be committed to the reform school, nor as to the amount which should be expended for their maintenance. The legislation conferred no power upon the authorities of either the city or the county to make any contract, and there is no pretense that they ever attempted to make one. The act of 1869 was plainly a distribution of the burdens of government, it gave to the county of Lawrence an advantage not possessed by the other counties in the western district of Pennsylvania, but that advantage did not grow out of any contract. The liability of the city to the county was purely statutory. There was no moral or legal obligation, apart from the statute, upon the city to reimburse the county. When the statute fell the right of the county to recover from the city was at an end.
The judgment is affirmed.