delivered the opinion of the Court.
This is an action of covenant brought by the Blue Ridge Hotel Company of Washington County, a corporation organized under the general incorporation laws of Maryland, against the Western Maryland Railroad Company, a corporation created by an Act of the General Assembly of Maryland, ch. 304 of 1852, under the name of “The Baltimore, Carroll, and Frederick Railroad Company,” the name being changed by ch. 37 of 1853 to “The Western Maryland Railroad Company.” The covenant sued upon is contained in a sealed agreement between the parties, made October 23rd, 1883. This agreement recites the making of a previous agreement between the parties on April 2nd, 1883, whereby the said railroad company, in consideration of anticipated advantages to it from the construction by the said hotel company of a summer hotel near Pen Mar Station on the line of said railroad, had agreed to secure the payment of a dividend not exceeding five per centum per annum on the capital stock of said hotel company of one hundred thousand dollars. The agreement sued on then further set forth that since the erection of said hotel, the railroad company had in fact derived large receipts from travel and traffic to and from the station used for said hotel, known as the Blue Mountain Station, and that its receipts from travel and traffic to and from an adjoining station, known as Pen Mar Station, had, by reason of the attractions of said hotel and its neighboring property, increased to an amount exceeding the utmost liability to be assumed by it, under the contact then made, and that it was believed these receipts would be largely augmented by increasing the capacity of the hotel, and by the improvement of the grounds of the hotel company, and of its other property near Pen Mar Station; that the hotel .company had already expended in the undertaking more *322than its whole capital, and an additional amount, not less than $125,000, was necessary to complete improvements begun, and others contemplated, which could not be procured without the assistance to the credit-of the hotel company as thereafter stipulated in said agreement; that the hotel company was about to issue its bonds to an amount not exceeding $125,000, bearing interest at the rate of six per cent per annum and to be secured by a first mortgage upon the said hotel and its revenues, and such other of its property as should be described in said mortgage. The agreement then further set forth that in consideratidn of the advantages expected to accrue to the railroad company from the said improvements to the hotel and its other property, and of certain privileges secured to the railroad company by the terms of said agreement for the benefit of its excursionists, the said railroad company covenanted with the said hotel company, as follows: “That if in any one year the actual net earnings of said hotel company from said hotel and other sources shall not suffice to pay five per cent dividend upon its capital stock of $100,000, and the interest at the rate of six per cent, semi-annually, upon such amount of said first mortgage bonds as may be issued for the purposes herein stated, not exceeding $125,000, the said railroad company will, in that event, allow and pay to said hotel company for its stockholders, and the holders of said bonds, such commissions upon its receipts from traffic to and from Blue Mountain and Pen Mar Stations, or any other station or stations which may be hereafter substituted for either, or both, of the above, at which the business hereby contemplated may be done, as will be sufficient to, make up said deficit to five per cent upon its capital stock, and six per cent per annum upon its bonded debt;’ ’ and the hotel company upon its part entered into a covenant designed to protect the railroad company in the proper application of the revenues of the hotel company to its economical and successful management, and of the net earnings to the dividends and interest due to its stockholders and bondholders. The declaration averred that in reliance upon this covenant of the railroad company, it issued its bonds *323to the amount of $125,000, of which $122,000 were still outstanding, which sum was expended in the improvements contemplated by the agreement, and that at the close of the fiscal year of the hotel company ending October 1st, 1903, the net earnings of the hotel company were not sufficient to pay the nterest then due on said bonds, by the sum of $3,660, and xt he re was nothing available for payment of the $5,000 dividend then due to its stockholders; that demand had been duly made on defendant for said sums, and that payment had been refused.
It will only be necessary to consider the defendants’ fourth plea which averred that the agreement sued on was ultra vires on the part of the railroad company, and void, and could not be enforced by suit su'ch as was brought against it. To this plea the plaintiff demurred, and the demurrer being sustained, the case went to trial on issues joined on the other pleadings, resulting in a verdict for the plaintiff for $9,433.68, and judgment thereon. The defendant offered six prayers of which the first and second raised the same question raised by the demurrer, and were refused by the Court, no prayers being offered by the plaintiff.
The question raised by the demurrer, and by the defendant’s first and second prayers, is the vital question in the case, and will now be considered.
The agreement was drawn with much care and skill, and evidently with a view to the avoidance of the question raised, as is suggested by the phraseology of the covenant "to alloiv and pay such commissions upon its receipts to and from” the stations named as would make good the deficit which was the subject of the covenant, but we do not think the use of this language can disguise the real character of the transaction, or control the validity of the obligation assumed by the railroad company. If the contract would be declared ultra vires if the deficit were to be made good from the general receipts of the company, it could not be rescued from invalidity, by calling the payment to be made, commissions from traffic receipts from the particular stations named. There is no limit to the rate *324of commission to be paid. The full amount of the gross receipts from these two stations was pledged by that covenant if required to make good this deficit. This appears not only from the language of the covenant, but even more explicitly from the recital of the mortgage from the hotel company to the trustees of its bondholders, which assigns to said trustees “the benefit of the contract between the hotel company and the railroad company, dated October 23rd, 1883, by which the payment of the interest on the said bonds is guaranteed by the said railroad company to be paid of the receipts from the traffic at Blue Mountain and Pen Mar Stations.” , A contract which in effect pledges the total gross receipts from any source, cannot be regarded as a contract for commissions on, or, a rebate from, those gross receipts, and this contract must | be regarded as an absolute guaranty to the stockholders and bondholders of the hotel company of their dividends and interest", tp the extent to which the receipts from the stations named should be adequate for that purpose, since in the language of the contract, the payment was to be made “to the hotel company for its stockholders and bondholders.” The promise thus made was a promise “to answer for the payment of some debt, or the performance of some duty, in case of the failure of another, who is himself, in the first instance, liable to such payment or performance.” 14 Am. & Eng. Ency. of Law, 1128, 2 ed. Its object, as declared in the recitals of the agreement was to furnish to the hotel company “assistance to its credit,” and it was at least twice designated in said agreement as a “traffic guarantee,” and we think it could not be accurately otherwise designated. It is therefore necessarily a collateral contract, but there is no question here of the Statute of Frauds, and it would make no difference so far as its validity is here concerned, if it- had been an original contract to pay the hotel company a lump sum upon the consideration stated. The question of idtra vires would still remain for consideration.
, Corporations, being mere creatures of law, possess only , such powers as are expressly granted, together with, such in*325cidental and implied powers as are necessary to carry into effect those expressly granted. “An incidental power is one that is directly and immediately appropriate to the execution of the specific power granted, and not one that has only a slight or remote relation to it. * * * It can in no case avail to enlarge the express powers, and thereby warrant the corporation to devote its efforts or its capital to other purposes than such as its charter expressly authorizes, or to engage in collateral enterprises, not directly, but only remotely connected with its specific corporate purposes.” io Cyc., 1097-1098. And it is equally well-settled that “a corporation has no power' to enter into a contract of suretyship ox guarantee, or otherwise lend its credit to another, unless the power is expressly conferred by its charter, or unless such a contract is reasonably necessary, or usual in the conduct of its business.” 7 Am. & Eng. Ency. of Law, 188, 2 ed.
The original charter powers of the Western Maryland Railroad Company are found in secs. 14, 15 and 18 of ch. 304 of the Acts of 1852. In addition to the mere power to construct a railroad from Baltimore to Westminster, and thence to some point on the Monocacy river in the direction of Hagerstown, the additional powers given are to erect warehouses or other works necessary to said road, and to contract with the Susquehannah Railroad for intersecting its road; to carry the mail and to bor- - row money no.t exceeding $200,000.
Chap. 71 of 1872 gave the power to construct a railroad from the western end of the tunnel of the Balt. & Potomac R. R. to Williamsport or to Cumberland together with all buildings, stations, other works and accommodations necessary or convenient for the operation of said road, and to execute mortgages upon its property for building the road. Sec. 8 of that Act, which is specially referred to by the Court below in the ruling upon the demurrer, set out in the record, gives power to aid any other company in the construction of its railroad, by means of subscription to its capital stock, or otherwise, for forming a connection therewith, and to consolidate with any other corporation owning a railroad, or a railroad *326and any other property; and chap. 153 of 1884 gives the only power of. guaranty it possesses, and limits this power to the obligations of other railroad companies.
In none of these Acts do we find any power, express or implied, either to engage directly in the construction and operation of a summer hotel, or to lend its credit to any other corporation engaged therein, while the Acts of 1872 and 1884, supra, seem to us, by their express limitation of the powers granted to dealing with railroad companies, or companies “.Owning a railroad and other property,” to exclude the power to engage in any other business than that of a railroad, or to guarantee the obligations of any other corporation than a railroad corporation. However the strict rules which we have cited above may have been relaxed or evaded elsewhere under the influence of competition in trade and commerce and of the modern theories of expansion of power in every direction, they are still approved by text writers of the highest authority and have been always observed and enforced by the Court in this State.
Judge Seymour D. Thompson, in 10 Cyc. 1146, says:
“Perhaps the most general statement which can be made of the doctrine of ultra vires, is to say that the contract of a corporation which is unauthorized by or in violation of its charter, or other governing statute, or entirely outside the scope of the purposes of its creation, is void, in the sense of being no contract at all, because of a total want of power to enter into it. ” And Mr. France in his recent excellent work on the Elements of Corporation of Law, sec. 72, says: “The transaction may be beyond the powers of the corporation, simply because it is foreign to the purposes expressed or implied in the charter; it may invoke the exercise of a power, not forbidden, but simply I ungranted, as, for example, where a railroad company undertakes to guarantee the expenses of a public festival. In the better usage, the term ultra vires is limited to acts of the latter 'class, and many of the Courts make a distinction between transactions which are illegal, because forbidden, and those which are simply in excess of the granted powers.”
*327In Steam Navigation Company v. Dandridge, 8 G. & J. 318, the Court said: “In Angelí and Ames on Corporations it is justly observed that a corporation and an individual stand upon very different footing. The latter, existing for the general good of society, may do all acts and make all contracts which are not in the eye of the law inconsistent with the great purpose of his creation ; whereas the former, having been' created for a specific purpose, can not only make no contract forbidden by its charter, which is, as it were, the latv of its nature, but in general can make no contract which is not necessary, either directly or incidentally, to enable it to answer that purpose. In deciding therefore whether a corporation can make a particular.contract, we are to consider in the first place, whether its charter or some statute binding upon it, forbids or permits it to make such a contract; and if the charter and valid statutory law are silent upon the subject, then, in the second place whether a power to make such a contract may not be implied on the part of the corporation as directly or incidentally necessary to enable it to fulfill the purpose of its existence, or whether the contract is entirely foreign to that purpose.” It was accordingly there held that the navigation company being incorporated only for the purpose of conveyance of passengers and freight, could not lawfully enter into a contract for breaking ice upon the waters navigated by its vessels, and towing other vessels through the track so made. And in Abbott v. Baltimore and Rappahannock Steamboat Company, 1 Md. Ch. 542, where the company was incorporated solely for the same purpose between Baltimore and Fredericksburg; but entered into an obligation in aid of an enterprise to improve the navigation of the river near Fredericksburg upon its own route, which would result to the great advantage of the company, it was held that the contract was not within its express or implied powers, and could not be enforced against it, though the obligee had incurred large expenses upon the faith of the contract. In the latter case the Chancellor followed the decision in the Dandridge case, supra, and that case has been repeatedly approved in this Court, upon the point *328here involved, the latest instance being in Boyce v. Trustees M. E. Church', 46 Md. 373. In State v. B. & O. R. R., 48 Md. 49, one of the questions was whether the receipts from certain hotels built and owned by the railroad company were subjected to the gross receipts tax imposed by the Act of 1872 upon such railroad companies, and the Court in construing the language employed in the power granted “to erect warehouses and other works necessary and expedient for the completion and operation of the road,” said on pages 76 and 77: “Hotels or buildings for the accommodation of passengers over the road are, we think, necessary to its business and therefore within its charter. * • * * The gross receipts therefore from these hotels are exempt from taxation.. The Oakland and Deer Park hotels, however, appear to have been built and are now used primarily as places of summer resort, and although as such they may attract travel over the road, they are not in any sense necessary to its operation. But the receipts from these hotels are not liable to the tax imposed by the Act of 1872, because they are not derived from the exercise of any franchise granted by the State, and they must be taxed according to valuation as other property.” The Court had previously said upon the same page, “It is hardly necessary to say that the original charter does not authorize the appellee to build and conduct hotels in the usual and ordinary manner in which hotels are kept, that is for the accommodation of the public generally.” The power to build and conduct such hotels was not actually before the Court under any of the pleadings in that case, and the language last cited therefore may perhaps be regarded as obiter, but the application of the gross receipts tax to such hotels was before the Court, and it was held not to apply to them because “the receipts were not derived from the exercise of any franchise granted by the State” — in other words, because the charter did not, either expressly or by implication, grant the power to engage in that business.
The cases we have cited from our own Courts sufficiently show how the law has been held in this State, and they are in *329accord with the best considered cases elsewhere in this country and in England. Thus in Davis v. Old Colony R. R., 131 Mass. 258, in which the subject was exhaustively considered by Judge Gray, it was held beyond the power of a railroad corporation, chartered by the Legislature, or of a corporation organized under the general law for the manufacture and sale of musical instruments, to guarantee the expenses of a musical jubilee and festival, and that no action could be maintained against either corporation upon such a guarantee, though made with reasonable belief that the holding of such festival would be of great pecuniary advantage to such corporations by increasing their proper business, and though the festival had been held and expenses incurred in reliance upon the guarantee. •
In Elevator Co. v. Memphis and Charleston R. R. Co., 85 Tenn. 703, the charter of the railroad gave it power “to do all lawful acts properly incident to a corporation, and to the transaction of the business for which it was incorporated, and also such additional powers as may be convenient for the due and successful execution of the powers granted in the charter.” The railroad company guaranteed eight per cent dividends upon the stock of an elevator company which built a grain elevator upon the line of the railroad but the Court held the guarantee could not be enforced, saying, “In no part of the grant of power, is that of guaranteeing the success ot another institution, person or corporation, to be found, either in expression or implication.”
In Pearce v. Madison and Indianapolis R. R. Co., 21 Howard, 441, the Supreme Court of the United States held that two corporations created to construct distinct lines of railroad leading to Indianapolis had no right without authority from the Legislature to consolidate into one corporation, and thereby to subject the capital of the one to- answer for the liabilities of the other. The managers had also established a steamboat line to run in connection with these railroads, and the Court held this to be “a departure from the business they were authorized to conduct, thereby diverting their capital from the *330objects contemplated by their charters, and exposing it to perils for which they afforded no sanction.”
In Coleman v. Eastern Counties Railway, 10 Beavan, 1, where the railway company proposed to guarantee the profits of a steam packet company to run in connection with the railway, Lord Langdale, Master of the Rolls, restrained the company by injunction, saying: “To look upon a railway company in the light of a common partnership, and as subject to no greater vigilance than these, would be greatly to mistake the functions they perform and the powers which they exercise, which are given by Act of Parliament, and which extend no farther than is expressly stated in the Act, or is necessarily and properly required for carrying into effect the undertaking and works which the Act has expressly sanctioned. * * *
.But it has been contended that they have a right to pledge without limit the funds of the company for the encouragement of other transactions, however various and extensive, ‘ provided the object of that liability is to increase the traffic upon the railway, and thereby to increase the profit to the shareholders. There is, however; no authority for anything of that kind.”
And in East Anglian Railway v. Eastern Counties Railway Co., 11 C. B. 775, where a similar guarantee was under consideration, it was held ultra vires, the Court declaring the question' to be one exclusively of power, and asking the unanswerable question, “What additional power do they acquire from the fact that the undertaking may in some way benefit their line? For whatever be their object or prospect of success, they are still but a corporation for the purpose of making and maintaining their railway.”
These cases which we have selected from the many that could be cited, sufficiently illustrate the principle which requires us to hold, as we do, that the agreement in this case is ultra vires.
But it is contended for the appellee that as the contract has been partly executed by both parties the railroad company is estopped to set up that defense.
*331Let us see how far this contention can be justified.
Judge Seymour D. Thompson in continuation of the passage from which we have quoted above, io Cyc. 1146, says: “Such a contract will not be enforced by any species of action in a Court of Justice; being void ab initio, it cannot be made good, by ratification, or by any succession of renewals, and no performance on either side, can give validity to the unlawful contract, or form the foundation of any right of action upon it.’’ It is true that the same distinguished author says, on page 1156 of Cyc. “The great mass of judicial authority seems to be to the effect that where a private corporation has entered into a contract in excess of its granted powers and has received the fruits or benefits of the contract and an action is brought against it to enforce the obligation on its part, it is estopped from setting up' the defense that it had no'power to make the contract.” This must be understood to mean however, that the fruits or benefits of the contract must have been received from the other contracting party, and not from outside parties. That this is the true meaning of the passage, appears from the language of the same writer on page 1155 of Cyc., where he says, “If the contract of a corporation is ultra vires, but not immoral or otherwise malum in se, and either party disaffirms it on the ground that it is ultra vires, and refuses further execution of it, then, while the other party cannot sue to recover damages or compensation in respect of the unexecuted portion of the contract, yet the law will afford him remedies for procuring from the other party a restoration of what he has lost under it. The governing principle is that where money has been paid or property transferred to a corporation, under a contract which is not malum in se, the party receiving may be made to refund to the party from whom it has received, the value of that which it has actually received, and to this end he may maintain against the corporation the equitable common law action for money had and received.” In Johnson v. Hines, 61 Md. 131, where the question under consideration was what title passed to mortgagees under a mortgage from one whose title was derived from an unauthor*332ized conveyance by a trustee, Judge Yellott speaking for this Court, said: “That nothing can emanate from nonentity, or, as more tersely enunciated, de nihilo, nil, is an axiom in the physical sciences which might be appropriately transferred to a judicial investigation of this nature.” This is certainly sound logic, and a void contract can no more give rise to a right of action upon such contract, than a void deed can create title in the grantee.
In Thomas v. West Jersey R. R., 101 U. S. 71, the railroad company made a twenty-year lease of its road, which was acted under for five years and was then repudiated by the railroad and the other party brought suit upon the contract. It was held void as ultra vires, but the' doctrine of estoppel was invoked by the plaintiff on the ground that the contract had been partly performed. The Court said: “It was the duty of the company to rescind or abandon the contract.' Though they delayed this for several years, it was nevertheless a rightful act when done. Can this performance of a legal duty, a duty both to the stockholders and the public, give the plaintiff a right of action ? To hold that this can be done, is in our opinion to hold that any act done under a void contract makes all its parts valid, and that the more you do under a contract forbidden by law, the stronger the claim to its enforcement in the Courts.”
In Central Transportation Co. v. Pullman Palace Co., 139 U. S. 62, under a contract held ultra vires, the Supreme Court again held that part performance was no ground for enforcing further performance of an unlawful contract, though the Pullman Company was required to account in an independent proceeding for the value of what it had received from the plaintiff under the contract, saying: “In such case the action is not maintained upon the unlawful contract, nor' according to its terms, but on an implied contract to return, or failing to do that, to make compensation for the property or money which it had no right to retain. To maintain such an action, was not to affirm, but to disaffirm the unlawful contract.” This is the doctrine of a majority of the State Courts of highest repute.
*333In Morville v. American Tract Society, 123 Mass. 137, the Court said: “The plaintiff’s money was taken and is still held by defendant under an agreement which it is contended it had no power to make. *. * * The plaintiff is not seeking to enforce the contract, but only to recover his own money and prevent the defendant from unjustly retaining the benefit of his own illegal act.”
In Day v. Spiral Springs Buggy Co., 57 Mich. 147, in a suit upon a speculative contract which was held ultra vires, the defendant pleaded in estoppel on the ground of part performance, but the Court, through Judge Cooley, said: “There are some decisions which give plausibility to the position of the. defendant, but we know of none that is adequate to the exigencies of this case. * * * The power on the part of such a corporation to enter into contracts of speculation, being withheld on reasons of public policy, for the protection of shareholders and the general good of the community, the act neither of one party nor of both, in entering into it can work an estoppel against setting up the invalidity. A rule of law established for the public good cannot be thus defeated. A corporation cannot, by the mere act of individuals, be given a power which tne State for general reasons has withheld from it. Steam Navigation Co. v. Dandridge, 8 G. & J. 248, 319. Parties may be estopped in some cases from disputing the validity of a corporate contract when it has been fully performed on one side and when nothing short of enforcement will do justice. To quote the language of Comstock, C. J.,in Parish v. Wheeler, 22 N. Y. 508, ‘the executed dealings of corporations must be allowed to stand for and against both the parties when the plainest rules of good faith so require.’ But this is not such a case. The contract has only been performed in part. * * * No valid' ground for estoppel is therefore found to exist in the case.”
Our own decisions have distinctly recognized the principle of the cases we have cited above. In Maryland Hospital v. Foreman, 29 Md. 524, the hospital had received money from Foreman under a contract which the Court said was not author*334ized by the powers conferred in its charter, and was therefore “simply ultra vires, and not binding upon the parties and Judge Bartol said: “The contract in all such cases will be regarded as void, and the party who delivered the property or advanced the money to the corporation will be entitled to his legal remedy, not founded upon, but in repudiation of the contract, to recover the property or the money from the corporation, upon the principle that it had acquired no right or title to either under the contract.”
So in Lester v. Bank, 33 Md. 563. The appeal was from an order ratifying an auditor’s account and allowing a claim for a debt due upon a loan made by the bank in violation of its charter, and the order was affirmed, the Court saying that “in cases arising under contracts made in violation of a statute^ it has been repeatedly held that an action would lje against a party receiving money under such a contract upon a promise implied by law to refund it.”
In Weckler v. First Nat. Bank, 42 Md. 582, the bank sold bonds on commission in violation of its charter powers, but paid over the proceeds to the owners of the bonds, and it was held that not having any of the plaintiff’s money obtained by means of the sale of the bonds, the defense of ultra vires was open to it.
In United German Bank v. Katz, 57 Md. 141, where the bank discounted a note in excess of its charter powers, a recovery was allowed upon the note, though the plea of ultra vires was made, but the principle upon which it is allowed, was stated to be “that it is inequitable to permit one who has received the benefit of the contract to repudiate it on the ground that the corporatiori from which he received the benefit had no power to make the contract;” so that the form of recovery, and not the substantial right of recovery was the thing in question there. This is the only case in Maryland to which we have been referred in which a recovery directly upon the void contract has been allowed at law. The case of Heironimus v. Sweeney, 83 Md. 146, like Lester v. Howard Bank,. was an equity case, and where the defendant has retained the *335fruits of the void contract, the plaintiff may either resort to the common law action for money had and received, or to an accounting in equity.
(Decided December 8th, 1905.)
The case of Bank v. Katz, supra, was cited in Black v. Bank of Westminster, 96 Md. 429, but in the latter case the declaration contained the common counts as well as a special count on the noté, and the recovery by the bank might be properly attributed to those counts, even if the note had been held to be purchased instead of discounted as it was held to be; and both those cases were cases of fully executed contracts in which the defendant sought to retain the fruits of the contract.
In this case, there is but one count in the declaration, and that is upon the void contract, and the proof is clear that the railroad company never received from the hotel company, either directly or indirectly, any money or property whatever under this contract. The only money it has received as a result of the contract, is that paid by passengers for transportation over its own road, or for freight carried over the road. The hotel company has paid nothing, and parted with nothing under this contract, and is therefore under all the authorities without any right of action.
It follows from what we have said that the demurrer to the defendants’ fourth plea should have been overruled, and the defendants’ first and second prayers should have been granted, and for the error in sustaining the demurrer and refusing those prayers, the judgment must be reversed. As there can be no recovery under our view of this case, it is unnecessary to consider the other rejected prayers of the defendant.
Judgment reversed without a new trial. Costs above and below to be paid by the appellee.