This is an appeal from a judgment which was entered on the pleadings. The amended complaint was filed January 25, 1890, and alleges that the “defendant, the' Northern Pacific Eailroad Company, is a corporation duly organized, created, and acting under the laws of the United *174States.” That the following contract in writing was entered into November 15, 1885: —
“ This indenture, made and entered into this fifteenth day of November, A. D. 1885, by and between the Northern Pacific Bailroad Company, party of the first part, and W. H. Bullard and Thomas U. Irvine, copartners under the firm name of Bullard and- Irvine, of Miles City, Montana Territory, parties of the second part, witnesseth: That the said party of the first part, for and in consideration of the covenants hereinafter mentioned, made and to be performed by the said parties of the second part, hereby promises and agrees to and with the said parties of the second part, to carry and transport over its line of railroad from St. Paul, Minnesota, to Miles City, Montana Territory, all the casks, cases, kegs, and barrels of beer which the said parties of the second part may deliver in car-load lots to the said party of the first part at said St. Paul, between the date hereof and the first day of November, A. D. 1887, for the sum of seventy-five cents for each and every one hundred (100) pounds of said casks, cases, kegs, and barrels of beer delivered as aforesaid in car-load lots.
“And the party of the first part further agrees to carry and transport over its said line of railroad from said Miles City, Montana Territory, to said St. Paul, Minnesota, all empty beer casks, cases, and kegs, and barrels which the said parties of the second part may deliver in car-load lots to the said party of the first part at said Miles City, between the date hereof and the first day of November, A. D. 1887, for the sum of fifty cents for each and every one hundred (100) pounds of said empty beer casks, cases, kegs, and barrels, delivered as aforesaid in car-load lots.
“And the said party of the first part further agrees that if between the date hereof and said first day of November, A. D. 1887, its regular schedule of freight rates on casks, cases, kegs, and barrels of beer, in car-load lots, from said St. Paul to said Miles City, and on empty beer casks, cases, and kegs, and barrels, in car-load lots, from said Miles City to said St. Paul, should be reduced to a sum less than the rates herein provided, the said party of the first part will thereupon permit the said parties of the second part to ship under and have the benefit of such lower regular schedule rates.
*175“In consideration of the premises, the said parties of the second part do hereby covenant and agree, jointly and severally, that they will well and truly pay, or cause to be paid to the said party of the first part, all sums which may become due under this contract for transportation as aforesaid. And • said parties of the second part further covenant and agree that they will not brew or manufacture any beer or other malt liquors at or within the corporate limits of said Miles City, Montana Territory, between the date hereof and said first day of November, A. ¡D. 1887.
“ It is further agreed by and between the parties hereto that in case any casks, cases, kegs, or barrels of beer, or any empty beer casks, cases, kegs, or barrels, belonging to or shipped by said parties of the second part, are injured or damaged in any manner whatsoever while in transit over or on the railroad of the said party of the first part, the said party of the first part shall not be liable therefor unless such injury or damage shall be caused by the negligence of the servants or employees of the said party of the first part.
“ In testimony whereof the said party of the first part has caused these presents to be signed by its general freight agent this fifteenth day of November, A. D. 1885, and the said parties of the second part have hereunto set their hands and seals this fifteenth day of November, A. D. 1885.
“ In duplicate. J. BE. BEannaford,
“General Freight Agent.
“W. BE. Bullard, [seal.]
“Thos. BE. Irvine.” [seal.]
It is further alleged “that subsequent to the making of the contract aforesaid, it was agreed and understood by and between the said parties that the freight on all the casks, cases, kegs, and barrels of beer which the said defendant might deliver, pursuant to the terms of the said contract, should be paid for by ihe said Bullard and Irvine at the regular schedule of freight rates on car-load lots charged by said defendant, and in case such schedule freight rates should be in excess of seventy-five cents per hundred pounds, that the overcharges should be rebated, settled, and paid by said defendant to the said Bullard and Irvine by vouchers, upon any and all such freight bills *176being forwarded by the said Bullard and Irvine to the said defendant.....That thereafter, and between the first day of January, 1887, and while said contract was still operative and in force, the said defendant delivered to the said Bullard and Irvine, at Miles City, Montana Territory, eleven (11) car loads of beer in barrels, the weight of which, in the aggregate, amounted to 235,710 pounds.....Upon the said eleven car loads of beer the way-bills were made out by the said defendant company, and the said Bullard and Irvine were required *by said company, and did pay freight thereon amounting in the aggregate to the sum of $2,358.77; .... that subsequent to the delivery of each of said car loads of beer, and pursuant to the agreement aforesaid, the said Bullard and Irvine forwarded the way-bills therefor to the general freight office of the said defendant company at St. Paul, Minnesota, accompanied by vouchers for the overcharges thereon, over and above the price specified in said contract, and demanded payment of the rebate thereon; . . . . that the said defendant has failed, refused, and neglected to pay to said Bullard and Irvine, or to this plaintiff, the said overcharges on the said eleven car loads of beer, or any part thereof, although often duly demanded; . . . . that the said overcharges on said eleven car loads of beer so paid by the said Bullard and Irvine, over and above the contract price therefor, and which said defendant agreed to pay to said Bullard and Irvine, amount to the sum of $590.95.”
It is also alleged that the said contract, and all rights, claims, and demands under it, were transferred and sold December 12, 1888, to Bullard. The prayer is for judgment against the defendant for the sum of $590.95.
The answer was filed May 9, 1890, and is as follows: “The defendant for answer to the amended complaint of plaintiff in this cause alleges that on the fourth day of February, 1887, there was passed by the Congress of the United States, and approved by the President, an act, entitled ‘ An act to regulate commerce’; that up to and including the fourth day of April, 1887, this defendant had duly performed all the conditions on its part of the contract in the said amended complaint set out and alleged, and has up to and including the fourth day of April, 1887, paid to the said Bullard and Irvine, and the said *177. Bullard individually, all rebates and overcharges of every kind and nature whatsoever due them by the terms of said contract, for all property shipped by the said Bullard and Irvine over the defendant’s road up to and including that date; and that all the claims made in plaintiff’s complaint have arisen, if at all, since the fourth day of April, 1887; that defendant did, in the month of March, 1887, by its duly authorized agent for that purpose, J. H. Hannaford, duly notify the said Bullard and Irvine, and the said Bullard individually, that by reason of the law hereinbefore named, and in obedience to the command and requirements thereof, all special and contract rates quoted to and entered into' by this defendant company with the said Bullard and Irvine would be canceled and declared null and void on the thirty-first day of March, 1887; that the said Bullard and Irvine, and the said plaintiff Bullard, individually, received the said notice from this defendant; that on and after the fifth day of April, 1887, by reason of the said law, and in compliance with the provision thereof, this defendant charged the said Bullard and Irvine for property shipped by its road, whether in car-load lots or otherwise, regular schedule rates for freight, and the same rates charged by it to any and all other persons for like contemporaneous service, and no more or less; that by reason of the said law, and the provisions thereof, and not otherwise, this defendant has refused, and does now refuse to pay the said plaintiff any rebate or drawback for goods shipped by defendant’s road since the fifth day of April,, 1887. Defendant denies that there is due the said plaintiff from this defendant by reason of the said contract, or by reason of any consideration whatever .... any sum.” Thereafter, on motion, the court rendered judgment in favor of Bullard for the amount prayed for in said complaint.
AVe assume, for the purposes of this inquiry, that the contract between the parties, which is set forth in the pleadings, was legal at the time of its execution. The act of Congress, “to regulate commerce,” which is mentioned in the answer, was approved February 4, 1887, but the provisions which we must examine took effect sixty days thereafter. Contracts similar to that before us are not excepted from the operation of this law, and became invalid under the second section, which is as fol*178lows: “That if any common carrier subject to the provisions of this act shall, directly or indirectly, by any special rate, rebate, drawback, or other device, charge, demand, collect, or receive from any person or persons a greater or less compensation for any service rendered in the transportation of passengers or property, subject to the provisions of this act, than it charges, demands, collects, or receives from any other person or persons for doing for him or them a like or contemporaneous service in the transportation of a like kind of traffic under substantially similar circumstances and conditions, such common carrier shall be deemed guilty of unjust discrimination, which is hereby prohibited and declared to be unlawful.” What; then, is the liability of the appellant to the respondent under the contract?
We confess that we are surprised to be unable to find any case in which this important question has been considered and determined by the courts of'last resort. In Kentucky & Indiana B. Co. v. Louisville & Nashville R. Co. 34 Am. & Eng. Ry. Cas. 630, Mr. Cooley, the learned chairman of the Interstate Commerce Commission, delivered the opinion and said: “ But the act to regulate commerce is a general law, and contracts are always liable to be more or less affected by general laws, even when in no way referred to. This is the case with State laws, as well as with federal. There probably was never an act passed in restraint of the sale of intoxicating drinks that did not affect some contracts, and render their literal enforcement impossible. The same may be said of the federal revenue laws. Nothing is more likely than that a considerable change in customs, regulations, and custom duties, or in the provisions made for enforcement of excise laws, will deprive some party of a right he supposed he had secured by contract. But the incidental effect of the general law is not understood to make it a law impairing the obligation of contracts. It is a necessary effect of any considerable change in the public laws. If the legislature had no power to alter its police laws when contracts would be affected, then the most important and valuable reforms might be precluded by the simple device of entering into contracts for the purpose. No doctrine to that effect would be even plausible, much less sound and tenable.” The order of the Interstate Commerce Commission in this case was reversed by the United States Circuit Court *179for the district of Kentucky upon grounds which, however, do not conflict with these views. (37 Fed. Rep. 567.)
Mr. Justice Jackson, in discussing the power of Congress over the subject, says: “No court has attempted to define the extent, limit, or scope of the power conferred by the Constitution upon Congress to regulate commerce among the States. The power is undoubtedly sovereign and exclusive. Prior to the passage of the Interstate Commerce Act, this power and exclusive authority over the subject was only exercised, with the exception of regulations for the protection of passengers upon navigable waters, and the transportation of live stock by railroads, through the judicial department of the general government in the way of restraining or annulling State legislation or action which undertook to interfere with, obstruct, or impose burdens or restrictions upon interstate commerce.” After citing the leading case of Gibbons v. Ogden, 9 Wheat. 1, he concludes: “Possessing such sovereign and exclusive power over the subject of commerce among the States, it is diflScult to understand why Congress may not legislate in respect thereto to the same extent, both as to rates and all other matters of regulation, as the States may in respect to purely local or internal commerce.”
Chief Justice Marshall, in Gibbons v. Ogden, supra, says: “We are now arrived at the inquiry, what is this power? It is the power to regulate; that is, to prescribe the rule by which commerce is to be governed. This power, like all others vested in Congress, is complete in itself, may be exercised to its utmost extent, and acknowledges no limitations, other than are prescribed in the Constitution.....If, as has always been understood, the sovereignty of Congress, though limited to specified objects, is plenary as to those objects, the power over commerce with foreign nations, and among the several States, is vested in Congress as absolutely as it would be in a single government, having in its constitution the same restrictions on the exercise of the power as are found in the Constitution of the United States.” The doctrine of Gibbons v. Ogden, supra, has been reiterated in many cases, and we have no hesitation in asserting that the act of Congress relating to the matter under consideration is in accord with the authorities and the Constitu*180tion. (Gloucester Ferry Co. v. Pennsylvania, 114 U. S. 196; Brown v. Houston, 114 U. S. 622; New Orleans Gas Co. v. Louisiana Light Co. 115 U. S. 650; Presser v. Illinois, 116 U. S. 252; Walling v. Michigan, 116 U. S. 446; Morgan v. Louisiana, 118 U. S. 455; Wabash etc. Ry. Co. v. Illinois, 118 U. S. 557; Robbins v. Shelby Taxing District, 120 U. S. 489; Kidd v. Pearson, 128 U. S. 1; Leisy v. Hardin, 135 U. S. 100.)
It is not necessary to determine whether Congress can pass a law which impairs the obligation of a contract, but it is a sound proposition that its power to legislate on this matter is at the least equal to that possessed by the legislatures of the States. The rules which have been applied to local legislation of this nature should be safe guides for us to follow in the adjustment of this contention. The Supreme Court of the Uuited States has uniformly upheld statutes which have been enacted in many States to regulate the compensation of railroad companies within their jurisdiction for the carriage of goods. In the construction of the general corporation law of the State of Iowa, Chief Justice Waite, in Chicago B. & Q. Ry. Co. v. Iowa, 94 U. S. 155, says: “Bailroad companies are carriers for hire. They are incorporated as such, and given extraordinary powers, in order that they may the better serve the public in that capacity. They are, therefore, engaged in a public employment affecting the public interest, and, under the decision iu Munn v. Illinois, 94 U. S. 113, subject to legislative control as to their rates of fare and freight, unless protected by their charters.....But when the legislature steps in and prescribes a maximum of charge, it operates upon this corporation the same as it does upon individuals engaged in a similar business .... Neither does it affect the case that before the power was exercised the company had pledged its income as security for the payment of debts incurred, and had leased its road to a tenant that relied upou the earnings for the means of paying the agreed rent.” The condition of the parties in Chicago M. & St. Paul R. R. Co. v. Ackley, 94 U. S. 179, when compared with that of the litigants in the case at bar, is reversed. The railroad company brought an action to recover a reasonable compensation for its services in the transportation of goods, which exceeded the maximum prescribed by the legis*181lature of the State of Wisconsin, and Chief Justice Waite said in the opinion: “As between the company and a freighter, there is a statutory limitation of the charge for transportation actually performed.....But for goods actually carried, the limit of the recovery is that prescribed by the statute.” It should be remembered in the treatment of these questions that the appellant has been incorporated by an act of Congress.
In referring to the Union Pacific Railroad Company, Chief Justice Waite says, in Sinking Fund Cases, 99 U. S. 700: “This corporation is a creature of the United States. It is a private corporation created for public purposes, and its property is to a large extent devoted to public uses. It is, therefore, subject to legislative control so far as its business affects the public interests.” ‘ In Railroad Commission Cases, 116 U. S. 307, Chief Justice Waite re-affirms this principle and observes: “It is now settled in this court that a State' has power to limit the amount of charges by railroad companies for the transportation of persons and property within its own jurisdiction, unless restrained by some contract in the charter, or unless what is done amounts to a regulation of foreign or interstate commerce.” (See, also, Munn v. Illinois, 94 U. S. 113; Peik v. Chicago & N. W. R. R. Co. 94 U. S. 164; Winona & St. Peter R. R. Co. v. Blake, 94 U. S. 180; Stone v. Wisconsin, 94 U. S. 181; Ruggles v. Illinois, 108 U. S. 526; Dow v. Beidelman, 125 U. S. 680.)
Inasmuch as dissenting opinions may be found in some of the cases which have been cited, it may not be deemed improper to quote from a recent decision of that eminent tribunal, which reconciles the differences referred to, and maintains the same doctrine. In Georgia Banking Co. v. Smith, 128 U. S. 174, Mr. Justice Field delivered the opinion and said: “The incorporation of the company, by which numerous parties are permitted to act as a single body for the purpose of its creation, or as Chief Justice Marshall expresses it, by which ‘the character and properties of individuality’are bestowed ‘on a collective and changing body of men/ (Providence Bank v. Billings, 4 Peters, 514, 562), the grant to it of special privileges to carry out the object of its incorporation, particularly the authority to exercise the State’s right of eminent domain that it may *182appropriate needed property — a right which can be exercised only for public purposes; and the obligation, assumed by the acceptance of its charter, to transport all persons and merchandise, upon like conditions and upon reasonable rates, affect the property and employment with a public use; and where property is thus affected, the business in which it is used is subject to legislative control. So long as the use continues, the power of regulation remains, and the regulation may extend not merely to provisions for the security of passengers and freight against accidents, and for the convenience of the public, but also to prevent extortion by unreasonable charges, and favoritism by unjust discriminations. This is not a new doctrine but old doctrine, always asserted whenever property or business is, by reason of special privileges received from the government, the better to secure the purposes to which the property is dedicated or devoted, affected with a public use. There have been differences of opinion among the judges of this court in some cases as to the circumstances or conditions under which some kinds of property or business may be properly held to be thus affected, as in Munn v. Illinois, 94 U. S. 113, 126, 139, 146; but none as to the doctrine that when such use exists the business becomes subject to legislative control in all respects necessary to protect the public against danger, injustice, and oppression. In almost every ease which has been before this court, where the power of the State to regulate the rates of charges of railroad companies for the transportation of persons and freight within its jurisdiction has been under consideration, the question discussed has not been the original power of the State over the subject, but whether that power had not been, by stipulations of the charter, or other legislation, amounting to a contract, surrendered to the company or been in some manner qualified. It is only upon the latter point that there have been differences of opinion.”
The liberal quotations from these opinions show clearly the grounds upon- which legislation similar to the provisions of the act of Congress under examination are based, and also the limitations which have been sometimes placed upon the law-making power in this regard. Counsel in their briefs have not pointed out, and we have been unable to find any case in which a contract like that in the complaint has been protected from the *183operation of a statute which fixed penalties for an unfair discrimination. by railroad companies in their tariffs for carrying freight. We think that'the significance of this fact can be easily understood when we inquire into the authority for this species of legislation by the States. The act of Congress derives its force from the grant of power by the Constitution “to regulate commerce with foreign nations, and among the several States.” (Const, art. i. § 8.) The local statutes, which have been reviewed by the foregoing authorities, are founded upon the police power of the States. No court has attempted to define this power with precision, although the general principles applicable thereto have been established firmly in jurisprudence. Says the great Chief Justice Shaw in Commonw. v. Alger, 7 Cush. 53: “We think it is a settled principle, growing out of the nature of well-ordered civil society, that every holder of property, however absolute and unqualified may be his title, holds it under the implied liability that his use of it may be so regulated, that it shall not be injurious to the equal enjoyment of others having an equal right to the enjoyment of their property, nor injurious to the rights of the community. .... Bights of property, like all other social and conventional rights, are subject to such reasonable limitations in their enjoyment, as shall prevent them from being injurious, and to such reasonable restraints and regulations established by law, as the legislature, under the governing and controlling power vested in them by the Constitution, may think necessary and expedient.....The power we allude to is rather the police power, the power vested in the legislature by the Constitution, to make, ordain, and establish all manner of wholesome and reasonable laws, statutes, and ordinances, either with penalties or without, not repugnant to the Constitution, as they shall judge to be for the good and welfare of the commonwealth, and of the subjects of the same.”
In Thorpe v. Rutland & B. R. R. Co. 27 Vt. 140; 62 Am. Dec. 625, Chief Justice Bedfield said in the opinion: “We think the power of the legislature to control existing railways in this respect may be found in the general control over the police of the country, which resides in the law-making power in all free States.....The police power of the State extends *184to the protection of the lives, limbs, health, comfort, and quiet of all persons, and the protection of all property within the State. According to the maxim, Sic utere tuo ut alienum non laidas, which being of universal application, it must, of course, be within the range of legislative action to define the mode and manner in which every one may so use his own as not to injure others. So far as railroads are concerned, this police power, which resides primarily and ultimately in the legislature, is twofold.” (See, also, Pierce on Railroads, 460; 2 Redfield on Railways [4th ed.], 232; State v. Winona & St. Peter R. R. Co. 19 Minn. 434; affirmed, 94 U. S. 180, supra; Watertown v. Mayo, 109 Mass. 315; 12 Am. Rep. 694; Commonw. v. Intoxicating Liquors, 115 Mass. 153; affirmed, 97 U. S. 25; Northwestern Fertilizing Co. v. Hyde Park, 97 U. S. 659; New Orleans Gas Co. v. Louisiana Light Co. 115 U. S. 650; Mugler v. Kansas, 123 U. S. 623; Rodemacher v. Milwaukee & St. Paul R. R. Co. 41 Iowa, 297; 20 Am. Rep. 592.)
In discussing this legislation, Pierce on Bailroads, supra, says: “Such laws may incidentally impair the value of franchises, or of rights held under contracts, but they are enacted diverso intuitu, and are not within the constitutional inhibition.” In Commonw. v. Intoxicating Liquors, supra, Mr. Justice Endicott, as the organ of the court, said: “Every such law limits, restrains, impairs, and in some cases destroys the uses, which were previously enjoyed, of the property so made the subject of legislation, but the extent to which it may do so does not affect the validity of such laws, or their equal application to all owners of such property. They are presumed to be passed for the common good, and to be necessary for the protection of the public, and cannot be said to impair any right, or the obligation of any contract, or to do any injury in the proper and legal sense of these terms.” In New Orleans Gas Co. v. Louisiana Light Co. supra, the court says: “The constitutional prohibition upon State laws, impairing the obligation of contracts does not restrict the power of the State to protect the public health the public morals, or the public safety, as the one or the other may be involved in the execution of such contracts.”
Another view of the controversy conducts us to the same con*185elusion. If the contract mentioned in the complaint had been fulfilled, it is plain that, after the act of Congress became effective, and during the period specified in the pleadings, there would have been a discrimination in favor of the respondent by the appellant in the sum of $590.95, on account of the transportation of his goods. In other words, the patrons of the Northern Pacific Railroad Company, who had no special agreement, would pay this amount for the same services in excess of what would be demanded of the respondent. It has been adjudged in many cases that when these circumstances arise, the contract, which was entered into by the parties in this action, is contrary to public policy and cannot be enforced. (Messenger v. Pennsylvania R. R. Co. 36 N. J. L. 407; 13 Am. Rep. 457; affirmed, 38 N. J. L. 531; 18 Am. Rep. 754; Scofield v. Railway Co. 43 Ohio St. 571; Christie v. Missouri Pac. Ry. Co. 94 Mo. 453; Chicago & A. R. R. Co. v. People, 67 Ill. 11; 16 Am. Rep. 599; Indianapolis D. & S. R. R. Co. v. Ervin, 118 Ill. 250.)
There is an old rule of law which can be invoked and applied to the case at bar. In Atkinson v. Ritchie, 10 East, 530, Lord Ellenborough, C. J., said in the opinion: “ That no contract can properly be carried into effect which was originally made contrary to the provisions of law, or which, being made consistently with the rules of law at the time, has become illegal in virtue of some subsequent law, are propositions which admit of no doubt.” Professor Pomeroy writes: “An illegal contract is, as a rule, void — not merely voidable — and can be the basis of no judicial proceeding. No action can be maintained upon it, either at law or in equity. This impossibility of enforcement exists, whether the agreement is illegal in its inception, or whether, being valid when made, the illegality has been created by a subsequent statute.” (Contracts, p. 280; Brown v. London, 9 Scott, N. S. 726; affirmed, 13 Scott, N. S. 828; 2 Parsons on Contracts [5th ed.], 674; Mounsey v. Drake, 10 Johns. 27; Jones v. Judd, 4 N. Y. 411.) The principles which have been stated are applicable to the act of Congress “to regulate commerce,” and the contract which has been described.
The respondent is not entitled to recover a judgment for any amount. The contract cannot serve as the foundation of any *186action by the parties thereto. It is therefore ordered that the judgment be reversed with costs, and that the cause be remanded, with directions to dismiss the action.
Harwood, J., and De Witt, J., concur.