
    Calumet and Chicago Canal & Dock Company, Appellant, v. Abel Davis, Trustee, Appellee.
    Gen. No. 25,144.
    1. Appeal and ebbob, § 179.7
      
      —when restitution may be refused on reversal. Restitution on the reversal of a case is not a matter of absolute right, but may, in a proper case and the exercise of a sound discretion, be refused.
    2. Mobtgages, § 656*—what is effect of reversal. The fact that the Supreme Court has held that a loan made by a corporation was ultra vires and the trust deeds securing it were invalid, on appeal from a judgment in proceedings to foreclose such deeds, and has reversed and remanded the cause, does not operate to give the mortgagor’s trustee in bankruptcy the right to recover from the corporation, on a petition by such trustee for restitution filed by him after the cause was remanded and redocketed, the proceeds received by it from the sale of the premises on foreclosure.
    3. Mobtgages, § 649*—when mortgagee is equitably entitled to portion of proceeds. Where the real consideration for a conveyance of a strip of land is a supposedly valid trust deed previously given by the grantee to the grantor on adjoining tracts, upon such trust deed being held invalid and a petition for restitution being filed by the mortgagor's trustee in bankruptcy for the recovery of the proceeds of the foreclosure sale thereunder, the mortgagee is equitably entitled to retain out of the proceeds the value of such strip, which had been also sold at foreclosure by virtue of a trust deed, given thereon as additional security for the indebtedness secured by the first trust deed.
    4. Mobtgages, § 649*—when rights of mortgagee are prior to those of other mortgagees. The rights of one who had, in good faith, loaned money on an invalid mortgage to enable the mortgagor to pay off a prior valid mortgage, for which purpose the money was used, to be subrogated to the mortgagor’s rights to the proceeds of a sale of the premises under such invalid mortgage, on a petition for restitution by the trustee in bankruptcy of such mortgagor to recover such proceeds, held prior to the rights of mortgagees under a junior mortgage.
    5. Spbbogation, § 24*—when mortgagee is entitled to subrogation. One who lends money on a defective mortgage to enable the mortgagor1 to discharge a prior valid mortgage upon the property is entitled to be subrogated, as against the trustee in bankruptcy of the mortgagor, to the rights of the prior mortgagee to the extent that the funds so loaned were used to discharge the prior mortgage and'will not be required to such extent to make restitution to the trustee of proceeds derived from the foreclosure and sale of the premises under the defective mortgage.
    6. Limitation or actions, .§ 99
      
      -—when statute applies. Statutes of limitations are not always controlling in equity but will or will not be applied as circumstances and justice demand.
    7. Subrogation, § 32*—when statute of limitations does not bar right. Where the trustee in bankruptcy of a mortgagor sues for the restitution of the proceeds of the sale of the premises under foreclosure, setting up the invalidity of the mortgage and the mortgagee claims to he entitled by subrogation to a portion of such proceeds because the loan to secure which its mortgage was given was made to enable the mortgagor to discharge a prior valid mortgage, the statute of limitations or laches cannot be interposed by such trustee to bar this claim of the mortgagee ■ to the right of subrogation, notwithstanding such claim is set up more than 5 years after the prior mortgage was paid.
    8. Bankruptcy, § 44*—what is extent of trustee’s right to plead limitations. With regard to his right to plead laches or limitations, the trustee in bankruptcy stands in the shoes of and has no greater rights than the bankrupt.
    9. Subrogation, § 24*—when mortgagee is not estopped to claim subrogation. The fact that one who has in good faith loaned money upon a defective mortgage to pay off a prior valid mortgage, for which purpose the money was used, proceeded in litigation -involving the foreclosure and sale of the property under its mortgage, on the theory that its mortgage was valid, does not estop it to claim the right of subrogation under the prior mortgage, when restitution of such proceeds is sought from it after its own mortgage is found invalid.
    10. Subrogation, § 24*—when permitting of subrogation is not evasion of decision denying relief. Where the Supreme Court held that a mortgage under which there had been a foreclosure and sale was partly valid and partly invalid and that the cause was "remanded to the circuit court for further proceedings not inconsistent with the views expressed in this opinion,” to permit such mortgagee, on a petition for restitution filed by the mortgagor’s trustee after the remanding and redocketing of the case seeking a money recovery against the mortgagee, to be subrogated to the rights of a prior mortgage, to pay which its money had been loaned and used, does not permit him to do by indirection what the Supreme Court had denied him the right to do directly, as he has the right to interpose to such petition any equitable defense which he may have.
    Appeal from the Circuit Court of Cook county; the Hon. Merbitt W. Pinckney, Judge, presiding. Heard in the Branch Appellate Court at the March term, 1919.
    Reversed and remanded with directions.
    Opinion filed April 30, 1920.
    Statement by the Court. This ease was formerly before this branch of this Appellate Court on writ of error from a decree of foreclosure, entered June 5, 1914, and here affirmed. (192 Ill. App. 613.) Upon certiorari the Supreme Court reversed the decree and the judgment of this court, and remanded the case “for further proceedings not inconsistent with the views expressed in this opinion.” (273 Ill. 318, 328.)
    The decree now appealed from was entered January 11, 1919, upon an amended petition for restitution (filed February 9, 1917, and further amended January 3, 1919) by Abel Davis, trustee in bankruptcy of the estate of Allen Conkling, bankrupt, he being one of the defendants in the original foreclosure proceeding, and in said decree it was ordered that Davis recover from appellant (hereinafter referred to as the Dock Company) the sum of $46,397.46.
    Early in January, 1909, Conkling owned in the Dock Company’s subdivision in South Chicago all that portion of Block 138 lying west of the right of way of the Pittsburg, Fort Wayne & Chicago Railway Company, which portion will for convenience be referred to hereafter as Block 138. The Dock Company owned Block 139. Between Block 138 and Block 139 was a strip of land, running north and south, dedicated as a public street and known as Erie avenue. The First National Bank of Chicago held Conkling’s past due note for about $30,000, which note was secured by a mortgage (referred to in this record as the Hagey mortgage) on Block 138, Conkling needed money to pay said note. He sent his agent, Eugene Hogue, to interview Murray Nelson, Jr., president of the Dock Company, and to obtain, if possible, a loan from the Dock Company to Conkling. Nelson told Hogue that the Dock Company was not in the business of making loans and suggested that Conkling go to other parties, and Nelson assisted in unsuccessful endeavors to negotiate the loan. Subsequently, Hogue informed Nelson that Conkling would like to buy certain lots in Block 139 owned by the Dock Company, and inquired if the Dock Company would make a loan to Conkling if Conkling purchased said lots, hereinafter referred to for convenience as Block 139. Further negotiations followed and resulted in the Dock Company selling Conkling Block 139 for $15,000, loaning him $35,000 cash and taking his notes for $50,000, secured by trust deed to Nelson, as trustee, on Blocks 138 and 139. No part of the purchase price of Block 139 was paid by Conkling at the time but it was included in the $50,000 for which said notes and trust deed were given. The notes and trust deed were dated January 22, 1909, and the last note matured 3 years from that date. It appears from the testimony of Nelson and William A. Rawson, secretary of the Dock Company, that the Dock Company would not have made the loan except as “an incident to the sale” of Block 139 for $15,000. It further appears that with the $35,000 so received by Conkling the note at the First National Bank, secured by the Hagey mortgage on Block 138, was immediately paid; that, as Hogue testified, Conk-ling “got the difference”; and that the Hagey mortgage was released. Nelson further testified on cross-examination by Mr. Wolff, solicitor for Davis, trustee:
    “The Dock Company was not in any way liable on the note which the First National Bank held. We were not satisfying that in order to release any claim against the Dock Company by the bank in any form. It was simply a loan to Conkling. The whole purpose of it was in order to take np this amount at the bank. At his request, or his agent’s request, we sought money for him to save him from failure.”
    On examination by Mr. Scott, solicitor of the Dock Company, Nelson further testified and the following occurred:
    “The Witness: The Hagey mortgage was upon part of the property which was conveyed to the Dock Company by this trust deed to me, which was being foreclosed in this proceeding.
    “Mr. Scott: There will be no question made that there was such a mortgage on the property? That was long before Oonkling made this deal.
    “Mr. Wolff: No.
    “Mr. Scott: And which is included in that conveyed by this trust deed? This money was used to pay off that mortgage ?
    “Mr. Wolff: A certain part of it.
    “The Witness: $30,215.86 is the amount which was paid to the First National Bank in satisfaction of that note.”
    On June 19, 1911, the Dock Company conveyed to Oonkling the strip of land known as Erie avenue and lying between Blocks 138 and 139, its dedication as a public street having been vacated; and on the same day Oonkling executed and delivered a second trust deed,-conveying said strip of land to Nelson, as trustee, to secure Conkling’s same indebtedness of $50,000, and subject to all the terms, conditions and covenants contained in said first trust deed of January 22, 1909.
    On October 13, 1910, Oonkling conveyed by quitclaim deed (recorded October 17, 1910) Blocks 138 and 139 to Thomas Carroll Neal to secure the payment of Conkling’s note for $11,000, due in one year and payable to the Monroe National Bank of Chicago ; and on October 13, 1910, Neal also executed a declaration of trust (recorded November 3, 1911) in which he declared that, subject to an incumbrance of $50,000, he held title to the property in trust to secure the payment of said $11,000 note. The. note of $11,000 subsequently became the property of the Central' Trust Company of Illinois.
    On November 18, 1911, Conkling was adjudicated a bankrupt in the U. S. District Court for the Northern District of Illinois, and on January 20, 1912, Abel Davis, appellee, was elected trustee of the estate and has since acted in that capacity.
    No part of the principal of said notes for $50,000, or of said $11,000 note, was ever paid by Conkling.
    On January 16, 1913, the Dock Company, and Nelson as trustee, filed a bill in the circuit court to foreclose the two trust deeds given to Nelson to secure said notes of $50,000. The bill was in the ordinary form of a bill to foreclose, containing the usual prayer for a sale of the mortgaged property to satisfy the debt and costs. To this bill Davis, as trustee of Conkling’s estate, Thomas Carroll Neal, and others, were made defendants. Davis, trustee, filed an answer denying the validity of the two Nelson trust deeds on the ground that the loan of $50,000 was ultra vires the Dock Company, and alleging that said trust deeds created no lien superior to his title as trustee. Neal and the Central Trust Company, successor to the Monroe National Bank by consolidation, filed their joint and several answer setting up their rights under said quitclaim deed and declaration of trust of October 13, 1910, and said unpaid note of $11,000. The cause was put a.t issue and referred to a master in chancery, who subsequently filed his report.
    On June 5, 1914, the circuit court entered a decree of foreclosure finding that there was due from Conk-ling to the Dock Company, upon the notes secured by the two Nelson trust deeds, the sum of $64,644.93, principal and interest, and $3,000 solicitor’s fees; further finding that Conkling on October 13, 1910, had conveyed Blocks 138 and 139 to Neal by said quitclaim deed, that Neal had given back said declaration of trust, that said Central Trust Company was the owner of said $11,000 note which was unpaid, but that the interest of Neal and said Central Trust Company in the premises was inferior to the lien of the Nelson trust .deeds and the indebtedness thereby secured; and ordering a sale of the premises within 5 days, unless, etc. On July 3, 1914, the master sold the premises (viz., Blocks 138 and 139 and said strip of land formerly known as Erie avenue) at public sale to the Dock Company. In his report of sale the master stated that he had exposed the premises for sale to the highest and best bidder for cash; that thereupon the Dock Company had bid the sum of $67,000 therefor; that said bid being the highest and best bid he accordingly had struck off and sold to the Dock Company the said premises for $67,000; that he had paid certain costs and then had paid the Dock Company the sum of, $66,585.20, including $3,000 solicitors ’ fees; that he had delivered to the Dock Company a certificate of sale and had caused a duplicate thereof to be recorded; and that the moneys arising from the sale were not sufficient to pay the amount found due to the Dock Company and that a deficiency of $1,311.09 remained due to it. With said report there was filed a receipt of the Dock Company, by its solicitors, acknowledging that the Dock Company had received from the master the said sum of $66,585.20, including $3,000 solicitors’ fees. On July 18, 1914, the court confirmed the master’s report of sale and distribution, and further ordered that no decree for said deficiency be entered against Conkling, but without prejudice to zthe right of the Dock Company to prove the amount of said deficiency as a claim against the bankrupt estate of Colliding.
    The foreclosure decree has been reviewed by this Appellate Court and by the Supreme Court upon writs of error brought by Davis, trustee. No supersedeas was issued by either court. The decree was affirmed by this Appellate Court on May 25, 1915. Oh Septenaher 15, 1915, an application for a writ of certiorari was made to the Supreme Court to review the decree • and the judgment of this Appellate Court, and on October 27, 1915, the writ was granted. The 15-montli period within which a redemption from the sale might be made had expired on October 4, 1915.
    On November 2, 1915, the Dock Company executed an assignment of the master’s certificate of sale to Edward F. G-orton. The Dock Company did not actually deliver said certificate to G-orton, but on said day delivered the same to the master in 'chancery, who had originally issued it, and instructed said master to' execute a master’s deed to said Gorton. The master executed the deed, and the same was recorded on November 3, 1915. G-orton actually paid the Dock Company, in consideration of the issuance and delivery of said master’s deed, the sum of $72,600.17. He was a stranger to the parties to the litigation.
    On February 16, 1916, the foreclosure decree was reversed by the Supreme Court. In the opinion of the court, on that day filed, the directions were that “the decree of the circuit court and the judgment of the Appellate Court are reversed and the cause remanded to the circuit court for further proceedings and decree in accordance with the views expressed in this opinion.” The Dock Company filed a petition for a rehearing, in which it said, among other things, that, in case the court should deny a rehearing, the form of the remanding order was wrong; that the property had been sold under the foreclosure decree and that the title “has now passed by master’s deed to a third party, who is not connected with this litigation and whose title, therefore, cannot be affected by a reversal of the decree of the circuit court”; that under the language used in said remanding order, the lower court “might consider -this to be a specific direction to enter a decree ordering a sale of the property to satisfy the $15,000 claim”; and that the form of said remanding order leaves it uncertain what is to be done with the liens of the other defendants to the suit, and “whether the Dock Company can, on re-docketing the case in the court below, present the question of subrogation by amendment of its bill.”
    On April 13, 1916, the Supreme Court denied the petition for a rehearing but modified the remanding order by striking out the directions for a decree, and said order of reversal and remandment, as modified, reads as follows: ‘ ‘ The decree of the circuit court and the judgment of the Appellate Court are reversed, and the cause remanded to the circuit court for further proceedings not inconsistent with the views expressed in this opinion.” (273 Ill. 318, 328.)
    From the opinion of the Supreme Court, as finally published, it appears that the court was divided, three of the seven justices dissenting. The opinion of the court was delivered by Mr. Chief Justice Farmer. It is therein said (p. 327):
    “Our conclusion from a consideration of the authorities is, that as to the loan of $35,000 the transaction was void and the trust deeds unenforceable. They Avere valid liens prior to the claim of the plaintiff in error as security for $15,000, the purchase price for Block 139, and subject to foreclosure, and all the property embraced therein is subject to sale for nonpayment of said sum according to the terms, proAÚsions and covenants of said trust deeds.”'
    On July 6, 1916, the cause was redocketed in the circuit court. On December 2, 1916, Davis, trustee, was given leave to file his petition for restitution, and on February 9, 1917, he was given leave to file and filed an amended petition for restitution.
    This amended petition for restitution set up the prior proceedings, the sale by the Dock Company to G-orton of the master’s certificate, the delivery of the master’s deed to Gorton, and alleged in substance that by reason of these matters petitioner had been wrongfully deprived of all his right, title and interest in and to the property, and the Dock Company had wrongfully gained the same benefit and advantage of the foreclosure decree of June 5,1914, and proceedings taken thereunder, as if the decree had been in all respects valid and had been affirmed by the Supreme Court; that petitioner had no remedy to compel the retransfer to him of said property and had no remedy against Gorton or his grantees or assignees; that, therefore, petitioner was entitled to restitution from the Dock Company and every other party to the litigation of all illegal or erroneous benefit or advantage which the Dock Company or any other party had gained under said decree; and that the Dock Company should be required to pay to petitioner (1) the present reasonable market value of the property, less any amount which might be due the Dock Company under the opinion of the Supreme Court, and (2) such amount as should be reasonable compensation to petitioner for the loss of possession of the property from the date of the master’s deed to Gorton. Petitioner prayed that the court hear evidence to determine what amount the Dock Company or any party to the decree should be required to pay to petitioner in restitution for said property, and that the court should enter the necessary orders, requiring the Dock Company, or any other parties to the litigation, to pay to petitioner such sums as might be found to be due him, and for other and further relief.
    •The Dock Company and Nelson, on March 5, 1917, filed their answer in which they admitted the allegations in said amended petition as to the prior proceedings, denied that petitioner was entitled to any restitution from them, and alleged in substance that in January, 1909, Block 138 was subject to the lien of an incumbrance to secure Conkling’s past due note, then owned by the First National Bank, that Colliding applied to the Dock Company for a loan with which to pay said note and promised to give it a. lien equal in rank to said incumbrance; that the Dock Company finally agreed to loan Conkling $35,000 with which to pay said note, on condition that Conkling would buy Block 139 for $15,000, and give his note for $50,000, to be secured by a trust deed, creating a lien equal in rank, on Blocks 138 and 139, and on January 25, 1909, said arrangement was actually consummated; that $30,215.86 of the money loaned by the Dock Company to Conlding was used for the purpose of extinguishing such prior incumbrance; that the payment had enriched Conkling’s bankrupt estate to that extent; that the Dock Company should be regarded as the equitable owner of the strip of land known as Erie avenue, which had been conveyed to Conkling without consideration and by him reconveved to Nelson, trustee, as additional security for the $50,000; that the title of the petitioner to the premises, according to the opinion of the Supreme Court, was subject to the lien of said two Nelson trust deeds to secure the repayment of the sum of $15,000, with interest, costs and charges; that said title of the petitioner was also subject to an equitable lien to secure the repayment of at least said sum of $30,215.86; that the Dock Company was entitled to have a new decree of sale of said premises in order to satisfy such of the obligations secured by the two Nelson trust deeds as had been declared valid by the Supreme Court, and also in order to satisfy said other equitable obligations; and that, if the Dock Company ought to make restitution in any amount to petitioner, it should have the right to retain, in equity and good conscience, out of the proceeds received by it, (1) said $15,000, and all other amounts paid for insurance, taxes, abstracts of title, attorneys’ fees, costs of foreclosure, etc.; (2) said sum of $35,000, with legal interest thereon, or, at all events, said sum of $30,215.86, with interest; and (3) so much of the proceeds as should be found to represent the value of said strip of land, known as Erie avenue.
    The Central Trust Company, on February 21, 1917, also filed an answer to the amended petition in which it alleged that it was interested in Blocks 138 and 139 by reason of the quitclaim deed by Conkling to Neal, and Neal’s declaration of trust of October 13, 1910, and said unpaid note of $11,000, and prayed that its rights be secured and protected.
    No replication to the answer of the Dock Company and Nelson, or that of the Central Trust Company, appears to have been filed at any time by petitioner Davis, trustee.
    A hearing on the amended petition was had in open court, during which certain documentary evidence was introduced, stipulations as to certain facts were made by counsel, and Murray Nelson, Jr., William A. Raw-son and Edward F. Gorton testified at length. It was agreed between counsel that in addition to this evidence, so presented in open court, the court should also consider all evidence contained in the record of the foreclosure suit as originally tried and as after-wards submitted to the Supreme Court.
    After the chancellor had announced that he would find in favor of Davis, trustee, the latter on January 3, 1919, by leave of court, filed an amendment to his amended petition in which it was alleged that petitioner was entitled to reimbursement and payment from the Dock Company of any and all benefit, profit, or money which the latter had gained under said foreclosure decree of June 5, 1914, after deducting all credits due the Dock Company under the opinion of the Supreme Court, together with interest on such balance. On the same day the Dock Company and Nelson, by leave of court, filed an amendment to their answer to Davis’ amended petition in'which they alleged that on October 13, 1910, Conkling, by quitclaim deed, conveyed to Thomas Carroll Neal Blocks 138 and 139, and on the same day Neal executed and delivered an instrument, wherein he declared that he held the title to said blocks, subject to said incumbrance of $50,000, not as owner but in trust to secure the payment of Conkling’s note for $11,000, payable to the order of the Monroe National Bank on or before one year from the date thereof, with interest thereon; that said note was at the date of said foreclosure decree of June 5, 1914, and at the date of the master’s sale thereunder owned by the Central Trust Company; that said note remains unpaid; and that no reconveyance of said property, or release of any interest created therein by said conveyance, has ever been made.
    On January 3, 1919, after Davis, trustee, had made said amendment to his amended petition for restitution, and before the Dock Company had been given leave to malee its amendment to its answer, argument was had before the chancellor relative to the latter amendment and as to the proposed decree which counsel for Davis, trustee, had drafted. Counsel for the Dock Company stated in substance that probably this amendment should have been made and the point covered thereby called to the attention of the court during the prior hearing, but that counsel had just become aware of the pertinency thereof; that Davis, trustee, seeks to affirm the foreclosure sale and recover from the Dock Company the difference between the amount bid for the property at said sale and such amount as was properly due to the Dock Company (according to opinion of the Supreme Court) under the two Nelson trust deeds, with interest on such difference; that he seeks to affirm on the theory that he has the legal title to the property and subject only to said valid lien of said Nelson trust deeds; that there is at least another valid lien on Blocks 138 and 139 (according to the foreclosure decree of June 5, 1914) viz., this Neal mortgage, evidenced by Conkling’s quitclaim deed and Neal’s declaration of trust both executed on October 13, 1910, to secure Conkling’s note of $11,000 of that date, plus interest; that this lien’ though inferior to the Dock Company’s valid liens, is superior to the rights of Davis, trustee, and that Davis, trustee, should be deemed to get only what Conkling would have been entitled to get; and that,, therefore, the proposed decree is wrong and that’the point should be called to the court’s attention. Counsel for Davis, trustee, in reply, argued that the Dock Company was in no position to raise the question on behalf of the holder of said note, Central Trust Company, which company was not itself asserting the claim. The court stated in substance that in his opinion, the Dock Company was not in the position to raise the point; that even if it had been raised by the Central Trust Company, Davis as trustee held the legal title to the property and was entitled to restitution; that the foreclosure decree of June 5, 1914, had been reversed by the Supreme Court; that, after Davis a.s trustee had acquired funds by restitution, to whom those funds belonged was a matter to be thereafter determined; that this could not now be passed upon because the court did not know from the proofs who, other than Davis as trustee, had valid claims on those funds or any part thereof; and that Davis as trustee was not entitled to a decree against the Dock Company without any deduction because of the claim evidenced by the Neal mortgage. The court further stated, however, that he would allow the amendment to the Dock Company’s answer to be filed so that the point could be properly preserved on appeal.
    The decree appealed from was finally entered on January 11, 1919. On that day, but prior to the entry of said decree, on motion of Leverett Thompson and said Thomas Carroll Neal, as trustee, the court ordered that Thompson be substituted as a party defendant in place of the Central Trust Company. And Thompson, and Neal as trustee, presented their verified petition, and proof of service of a copy thereof upon counsel for Davis and the Dock Company on January 10, 1919, and asked leave to file said petition instanter, but the court, on objection by counsel for Davis, trustee, refused to allow it to be filed. It is alleged in said petition that Thompson is the owner of said $11,000 note, formerly belonging to the Central Trust'Company; that said note is secured by the conveyance from Cohkling to Neal and by the declaration of trust by Neal; that the rights of petitioners to the property which was sold under the foreclosure decree, or to the purchase price at the sale under said decree, are, by virtue of the judgment of the Supreme Court and its remanding order and the facts disclosed in the record, paramount to the rights of Davis, trustee, and of any other person except the Dock, Company; that in the event it shall be decreed that the Dock Company is not entitled to retain the purchase price, or some part thereof, the petitioner, Thompson, as the owner .of said note, is entitled to be paid out of the amount which the Dock Company may be required to pay, or, in the alternative, if the court shall not decree that the Dock Company pay over said purchase price, or any part thereof, then petitioner, Thompson, is entitled to a lien on the premises and to be first paid out of the proceeds of a sale the amount of his said claim, together with interest, costs and attorneys’ fees. Before the court refused to allow said petition to be filed, statements were made, and considerable argument was indulged in, by respective counsel, including Mr. Phillips, solicitor for the Central Trust Company. Mr. Hamill, solicitor for petitioners, presented the petition and it developed that negotiation's for the purchase from the Central Trust Company of said $11,000 note had been begun on December 13, 1918, and that Thompson actually purchased it on December 31,1918. The court finally ruled that it was a matter of the court’s discretion, and that he would exercise that discretion by refusing to allow the petition to be filed.
    In the decree as finally entered the court found, among other things, that Davis, trustee, had the right at the time of the filing of his petition for restitution, at his option, to recover the property sold, or to affirm the sale and recover from the Dock Company the difference between the amount bid for the property at said sale and such amount as was due and owing to the Dock Company under said Nelson trust deeds, with interest on such difference, and that said Davis, trustee, has elected to affirm said sale and recover said money; that after the court had announced his findings and had instructed counsel to prepare the decree (prior to January 2, 1919, when the first draft of the decree was first presented to the court), to wit, on December 31, 1918, Leverett Thompson acquired all interest of the Central Trust Company in the deed from Conkling to Neal and the instrument of trust from Neal to Conkling, and in and to all notes secured by said instruments; that, from admissions by counsel of the Central Trust Company made in open court, the said company was and is chargeable with notice of all proceedings in this cause up to December 31, 1918, the date when it so transferred its interest to said Thompson; and that petitioner, Davis, as trustee, is entitled to recover from the Dock Company the amount for which the master sold said property on July 3, 1914, less certain credits which were on that date due to the Dock Company under the opinion of the Supreme Court, and said Davis, as trustee, is also entitled to interest on the net amount due him from July 3, 1914, and that a true and correct statement of the amount which he should recover from the Dock Company, and of the credits then due the Dock Company, is itemized as follows: (Here is set forth an itemized statement showing that the master received $67,000 from the sale of the premises to the Dock Company on July 3, 1914; that- of this amount the Dock Company was entitled to credits aggregating the sum of $29,124.42, leaving a balance of $37,875.58, which should have been paid to Davis, trustee; that interest at 5 per cent per annum on said balance from the date of said sale to January 3, 1919, amounts to $8,521.88, which being added to the said balance makes a total sum due Davis, trustee, of $46,397.46). The court ordered and decreed that Davis, trustee, recover of the Dock Company said sum of $46,397.46.
    At the end of the hearing in open court on the amended petition for restitution, counsel for Davis, trustee, moved the court to exclude from the record all testimony of Mr. Nelson and Mr. Rawson, so far as it related to the payment of. any money to the First National Bank of Chicago or to any conversation that the $35,000 loan by the Dock Company to Conkling was made for the purpose of relieving the property from another incumbrance; whereupon counsel for the Dock Company stated that he understood that the court would overrule the motion to strike and would permit the Dock Company to offer the evidence; whereupon the court said: “My position was then and is now that your contention that you have a right to be subrogated to the First National Bank to the extent that your payment of that amount of money that your witness testified you paid is not a good contention and comes too late. * * # I was against you on that contention and have been right along. I did say this, that I did not think I should sustain their motion to strike, but I thought that they should file a replication to your answer and then to your testimony, and upon objection I would sustain the objection, but that, in order to give you the benefit of your record, the testimony ought to be offered. I do not see any reason for changing my view * * * and I will sustain the objection to the testimony as offered.” Counsel . for Davis, trustee, in their printed argument here filed, in commenting upon the court’s rulings, say: “This gave the Dock Company the opportunity to call the evidence to the attention of the reviewing courts, and if this (Appellate) Court or the Supreme Court should hold that the evidence was improperly stricken, then it might be considered without the necessity of remanding the cause.” Counsel for the Dock Company have, by leave of this Appellate Court, presented additional assignments of error, which sufficiently call in question the said rulings of the trial court. It thus appears that the evidence offered on the question of the right 'of the Dock Company to be subrogated to the rights of the holder of the note secured by the Hagev mortgage is properly before this court on review of this record.
    After the Dock Company’s appeal had been perfected in this court, Leverett Thompson and Thomas Carroll Neal, as trustee, on June 10, 1919, sued out a writ of error from this court, case No. 25,318, to reverse the order of the circuit court of January 11, 1919, refusing them leave to file their petition, and to reverse said decree of January 11, 1919. On October 15, 1919, on their motion, this court ordered that the record filed in the Dock Company’s appeal ease, No. 25,144, stand as an additional record in case No. 25,318, and on November 11, 1919, this court further ordered that the two causes be consolidated here for hearing.
    Scott, Bancroft, Martin & Stephens, for appellant; Frank H. Scott, of counsel.
    Jesse Lowenhaupt and Oscar M. Wolff, for appellee.
    
      
      „ *See Illinois Notes Digest, Vole. XI to XV, and Cumulative Quarterly, sanie topic and section number.
    
    
      
       See Illinois Notes Digest. Vols, XI to XV, and Cumulative Quarterly, same topic and section number.
    
   Mr. Justice Gridley

delivered the opinion of the court.

The main contention of counsel for the Dock Company is that it was error for the court to decree that Davis, trustee, recover the sum of $46,397.46 from the Dock Company, and for the reason that $30,215.86 of the $35,000 borrowed was used for the purpose of paying off Conkling’s past due note secured by the Hagey mortgage, and the Dock Company is entitled to be subrogated to the rights of the owner of that incumbrance.

In 1 Jones on Mortgages, sec. 874c, it is said:

“One who loans money on a. defective mortgage for the purpose of discharging a prior valid mortgage upon the same property, and the money is used for that purpose, is ordinarily subrogated to the rights -of the prior mortgagee.”

In Home Sav. Bank v. Bierstadt, 168 Ill. 618, Mary Bierstadt loaned to W. K. Lowrey $25,000 for the purpose of paving off seven trust deeds to Goudy, which were first liens respectively on seven lots. After the making and recording of said trust deeds Lowrey executed a trust deed to Billings on three of’ said lots to secure a note for $5,250, payable to the Home Savings Bank. This Billings trust deed was of record at the time the trust deed given to Hurlbut for the benefit of' Bierstadt was recorded, but did not show in an abstract of title which had been brought down, and Bierstadt had no notice that the Billings trust deed was in existence until she filed her bill to foreclose said trust deed given for her benefit. Bierstadt charged in her bill that at the time of. the execution of the Billings trust deéd both Billings and the bank knew of the existence of the Goudy trust deeds and that the Billings trust deed was subject thereto. Bierstadt asked that she be subrogated to the rights and lien of Goudy, the indebtedness secured by said Goudy trust deeds having been paid with her money, and it was held that she was entitled to such subrogation. It is said in the opinion of the court (p. 623):

“Subrogation, as a principle of equity jurisprudence, is generally confined to the relation of principal and surety and guarantors, or to a case where a person is compelled to remove a superior title to that held by him iii order to protect his own, and also to cases of insurers. * * * Whilst these general heads include the doctrine and principles of subrogation, that doctrine has been steadily expanding and growing in importance and extent in its application to various subjects and classes of persons. This equitable principle is enforced solely for the accomplishment of substantial justice, where one has an equity to invoke which cannot injure an innocent person. The right of subrogation which springs from the mere fact of the payment of a debt, and which is included under the heads first above stated, is what is térmed legal subrogation, and exists only where included within these classes. But in addition to this principle of legal subrogation there exists another principle, which is termed conventional subrogation, which results from an equitable right springing from an express agreement with the debtor, by which one advances money to pay a claim for the security of which there exists a lien, by which agreement he is to have an equal lien to that paid oft', whereupon he is entitled to the benefit of the security which he has satisfied with the expectation of receiving an equal lien. * * * It is the agreement that the security shall be kept alive for the benefit of the person mailing the payment which gives the right of subrogation, because it takes away the character of a mere volunteer. * * * This principle will be applied even where the record shows a release of the satisfied incumbrance, as the lien so satisfied will be removed for the benefit of the party satisfying the same, when there has not been gross negligence and when justice requires it should be done,—and this will be done as against a subsequent incumbrancer whose incumbrance has not been taken or his position changed because of the record showing the discharge of the senior incumbrance.”

The principles of legal and conventional subrogation as stated in the Bierstadt case were restated with approval in Novak v. Kruse, 288 Ill. 363, 368. Beference may also be made to the cases of Tyrrell v. Ward, 102 Ill. 29; Trademen’s Building & Loan Ass’n v. Thompson, 32 N. J. Eq. 133; Levy v. Martin, 48 Wis. 198; Cumberland Building & Loan Ass’n v. Sparks (C. C. A. 8th Cir.), 111 Fed. 647, 652; In re Lee (C. C. A. 8th Cir.), 182 Fed. 579; Butts County v. Jackson Banking Co., 129 Ga. 801; Kearny County Board of Com’rs v. Irvine (C. C. A. 8th Cir.), 126 Fed. 689; Hicks v. Beals, 83 Ore. 82; Adams v. Young, 200 Mass. 588.

In the Lee case, supra, the rights of a trustee in bankruptcy were involved. One Hollicke was the owner of a promissory note signed by a party that afterwards became a bankrupt. This note was secured by a mortgage on premises owned by said party. Prior to the bankruptcy proceedings Hollicke, instead of foreclosing his mortgage, obtained a judgment upon the note. Thereupon said party, to prevent a seizure and sale of its property, prevailed upon Lee to loan it sufficient money to pay the Hollicke judgment, stipulating that it would procure for Lee an assignment of Hollicke’s mortgage and that Lee should be subrogated to the rights of Hollicke. Lee advanced the money and the Hollicke judgment was paid. Hollicke refused to assign the mortgage but released the same of record. Thereafter said party, within 4 months of its adjudication as a bankrupt, gave to Lee a new mortgage upon the same premises to secure the repayment of Lee’s loan. The court held that Lee was entitled to be subrogated to the rights of the Hollicke mortgage, as against the trustee in bankruptcy. In the opinion it is said (182 Fed. 583) :

“Counsel argue that this second mortgage was voidable by the trustee because it was made so long after Lee loaned the money that it constituted a voidable preference under section 60b of the Bankruptcy Law, and because it was not recorded. * * * If this second mortgage was valid, it created a lien upon the property, and entitled the petitioner to the relief he sought. If it was void or voidable, why was he not entitled to be subrogated to the rights of Hollicke under his mortgage which the money of the petitioner paid? May not one who, in reliance upon the agreement of the owner of property to give him a first lien thereon to secure his repayment, loans money to pay off a prior incumbrance and takes a defective mortgage or other security, be subrogated to the rights of the prior incumbrancer so far as necessary to secure the payment of his claim? This question received an exhaustive examination and the most thoughtful consideration of this court in 1901, in the case of Cumberland Building & Loan Ass’n v. Sparks, 111 Fed. 647.” (Here is quoted a portion of the opinion in said Sparks case, followed by the statement that the rule thus announced is just and reasonable and that the case at bar falls under it.) "“The property of the bankrupt was subject to a valid mortgage for $522.22 to Hollicke. It agreed with the petitioner in consideration of his advance of the money to pay that debt that he should have the benefit of that lien and the first mortgage upon the property to secure the repayment of his money. The debt was paid with that money. If the bankrupt could now repudiate its obligation and hold the property free from the lien because it subsequently made a voidable mortgage, it would secure without compensation, and the petitioner would lose, a large part of the money that the latter advanced. * * * The claim of Lee is stronger than that of the complainant in Cumberland Building & Loan Ass’n v. Sparks, * * * because there is no purchaser for value in this case, but the trustee stands in the shoes of and has no greater rights against Lee than the bankrupt. There is no proof or claim that there are any creditors who permitted the bankrupt to contract debts to them after the release of the Hollicke mortgage in reliance upon its satisfaction, and reason and the law alike demand that the claim of the petitioner to his lien upon the proceeds of the property by subrogation to the rights of Hollicke should be sustained.”

The Butts County case and the cases following it, cited above, are cases deciding that thougfi a loan is void for lack of power to make it (as the Supreme Court held in substance the $35,000 loan in the present case was), yet, if the moneys loaned are used to pay off existing obligations of the borrower, the right of subrogation under certain circumstances exists. In said Butts County case, 129 Ga. 801, the county borrowed from time to time various sums of money evidenced by notes from the Jackson Banking Company for the purpose of providing funds for the immediate payment of county warrants, in anticipation of taxes which could be legally levied, and the money ivas actually used for that purpose. The county commissioners denied liability on the notes and refused to reimburse the bank for the money paid to the warrant holders. In the suit brought by the bank it prayed for judgment on the notes, but, if the contract of loan be declared illegal, that the bank be decreed to be the owner of the warrants which it had paid and be subrogated to all the rights of the several warrant holders. The court held that the contract of loan was in violation of the Constitution of the State of Georgia and that the notes were not enforceable, but also held that the bank was entitled to subrogation to the rights of the warrant holders whose warrants had been paid out of the proceeds of the illegal loans. The court says (p. 807):

“Counsel for plaintiffs in error contend that the illegality of the notes pervades the whole transaction, and bars a recovery of the money, even though beneficially applied to a lawful purpose. To this contention we cannot give our assent. It is very generally held that counties and municipal corporations are liable for money had and received by them and applied beneficially to their authorized objects, although the contract by which the money was obtained was unauthorized by law. * * * The principle of liability rests upon the theory that the obligation implied by the law to pay does not originate in the unlawful contract, but arises from considerations outside of it. * * * The obligation to account for money received by the county, and actually devoted to lawful purposes, rests upon the broad principle of common honesty, which will not permit the county to retain the benefit of money lawfully applied to its use, and at its request, simply because the county lacked the power to borrow the money.”

In the Irvine case, cited above (126 Fed. 689), the purchasers for full value of certain county bonds, issued for and the proceeds of which were used in payment of county warrants, and which warrants were surrendered and canceled upon payment, were held to be entitled to be subrogated in equity to the rights of the original warrant holders, where said bonds had been adjudged void for want of power in the county to issue them. In the Hicks and Adams cases, supra, subrogation was decreed under the particular facts where the transactions were in violation of the Bulk Sales Act. In the Adams case (200 Mass. 588) the stock in trade of an insolvent corporation in its store was subject to two valid chattel mortgages, and the corporation sold said stock in bulk, in violation of the Bulk Sales Act of Massachusetts, to a purchaser whose money paid the amount due on the mortgages, the balance over being received by the corporation. One mortgage was released of record, and the other and the note which it secured were assigned to said purchaser, who immediately took possession of all of said stock. The corporation and the purchaser acted in good faith and with no intention to defraud the creditors of the corporation. Thereafter the corporation was adjudged bankrupt and a trustee was appointed, who sought by bill in equity to gain possession of said stock, but who did not offer to pay said purchaser the amount he had paid on the mortgages. It was held that the purchaser, having acted in good faith, was entitled to be subrogated to the rights of the mortgagees and the bill was dismissed.

It appears in the present case that in January, 1909, nearly 3 years before he was adjudicated a bankrupt, Conkling was in need of money to pay his past due note, held by the First National Bank and secured by the Ilagey mortgage on Block 138, and to prevent his possible failure in business; that he applied to the Dock Company for assistance; that after negotiations it was agreed in substance that on condition that Conk-ling would purchase of the Dock Company Block 139 for $15,000 the Dock Company would loan Conkling $35,000, and it was further agreed, in substance, that, in consideration of the Dock Company conveying Block 139 to him and nogotiating said loan, Conkling with the $35,000 so loaned would pay off said note and have said Hagey first mortgage released and give his notes aggregating $50,000, to be secured by a trust deed, creating a first lien, on Blocks 138 and 139, and that on January 25, 1909, said arrangement was actually carried out, and of the said $35,000 loan $30,215.86 was actually paid to said bank and the note canceled and the Hagey incumbrance released; that Conkling never paid any part of the principal of the $50,000 notes; that about a year after Conkling had been adjudicated a bankrupt the Dock Company (believing it had a valid first lien securing the entire indebtedness, costs, etc.) filed its bill to foreclose said trust deed given to secure said notes for $50,000 (and also to foreclose another trust deed on Erie Avenue given to secure the same indebtedness); that a decree of foreclosure was afterwards entered, and on July 3, 1914, the premises were sold to the Dock Company for $67,000, and a certificate of sale given to it; that the foreclosure decree was afterwards affirmed by this Appellate Court; that on October 4, 1915, the 15-month redemption period expired; that on October 27, 1915, a writ of certiorari was granted by the Supreme Court • to review said foreclosure decree and the judgment of this Appellate Court, but no supersedeas was issued bv the Supreme Court; that 6 days thereafter, on November 2, 1915, the Dock Company (still believing that the trust deeds which it had foreclosed had been valid first liens securing said $50,000 indebtedness, costs, etc., and further believing it had a lawful right to sell the master’s certificate of sale, or obtain a master’s deed for the premises and sell said premises) executed an assignment of said master’s certificate of sale to Edward F. Gorton, delivered the same to the master and instructed him to execute a master’s deed to Gorton; that the master executed such deed and Gorton actually and in good faith paid the Dock Company the sum of $72,600.17; that subsequently the Supreme Court reversed said foreclosure decree and the judgment of this Appellate Court and remanded the cause to the circuit court “for further proceedings not inconsistent with the views expressed in this opinion”; that in said opinion the Supreme Court stated its conclusion to be that “as to the loan of $35,000 the transaction was void and the trust deeds unenforceable,” that, however, said trust deeds “were valid liens prior to the claim of the plaintiff in error as security for $15,000, the purchase price of Block 139, and subject to foreclosure.”

‘ Under such a state of facts, and in view of the decision and remanding order of our Supreme Court in the foreclosure case, and under the law a.s disclosed from the decisions above referred to, we are of the opinion that the Dock Company is entitled to be subrogated to the rights of the First National Bank, the owner of said note secured by the Hagey mortgage, at least to the extent of $30,215.86, the amount actually paid according to the agreement out. of said $35,000 loan to satisfy said note and release said mortgage, and that the Dock Company, on the petition of D'avis, trustee for Conkling’s bankrupt estate, should not be required to pay to said Davis, trustee, in this proceeding-, any part of said $30,215.86, out of the moneys received at the sale of July 3, 1914.

It is admitted by counsel for Davis, trustee, that the law of this State is such that, although the trust deeds are unenforceable as to the $35,000 because that portion of the loan was ultra vires the Dock Company, still the Dock Company might sue Conkling’ in an action for money had and received and, if Conkling was not a bankrupt but was able to respond, might recover of him in such an action that portion of the $35,000 loan which was actually used in satisfying the Hagey incumbrance. But counsel contend (1) if the Dock Company ever had a right of subrogation it has expired by limitation; (2) the claim of subrogation is inconsistent with the original position taken by the Dock Company in this litigation; and (3) to allow subrogation in this case would permit the Dock Company “to do indirectly what the Supreme Court has said it cannot do directly.” J

In support of the first contention counsel for Davis, trustee, argue in substance that the note at the First National Bank was paid on January 25, 1909; that if the' Dock Company ever acquired any right of subrogation that was the date when that right accrued; that the amended petition for restitution was filed on February 9, 1917; that the Dock Company’s answer thereto, in which it set "up its right to subrogation, was filed on March 5, 1917, more than 8 years after such right had accrued; that this right is barred by the statute of limitations of 5 years; that equity follows the law; and that, therefore, the Dock Company cannot enforce subrogation. Counsel cite the cases of Simpson v. McPhail, 17 Ill. App. 499, and Junker v. Rush, 136 Ill. 179, in support of their contention. But, after the Dock Company had received the money from Gorton and after our Supreme Court had made its final decision in the foreclosure ease, it was Davis, trustee, and not the Dock Company, who appeared in a court of equity asking affirmative relief. He filed a petition in which, as amended on January 3, 1919, he alleged in substance that he was entitled to reimbursement from the Dock Company out of the moneys which it had unlawfully gained by reason of the foreclosure decree; and prayed that the court decree that the Dock Company pay him such an amount as should be found justly due him. And statutes of limitations are not always controlling in equity, and such statutes will or will not be applied as circumstances and justice demand. (1 Pomeroy’s Eq».Juris, secs. 385, 386; Farmers’ Loan & Trust Co. v. Denver, L. & G. R. Co. [C. C. A. 8th Cir.], 126 Fed. 46; Brent v. Bank of Washington, 10 Pet. [U. S.] 596, 616; DeWalsh v. Braman, 160 Ill. 415, 420; Booth v. Hoskins, 75 Cal. 271, 276.) Under the peculiar facts here presented and under these authorities we do not think that the statute of limitations or laches can properly be a bar to this defense of the Dock Company as disclosed by its answer to the amended petition for restitution. And this defense is just as effective, as it seems to us, against Davis, trustee, as it would be against Conic-ling, and for the reason, as stated in the Lee case above cited (182 Fed. 579, 584), that “the trustee stands in the shoes of and has no greater rights * * * than the bankrupt.” In the Farmers’ Loan & Trust Co. case, supra, it is said (p. 51):

“Even if such a.bar had arisen, it did not prohibit a court of chancery from requiring a complainant who sought its aid to recognize and pay an equitable demand of a defendant, which the latter could not affirmatively enforce, as a condition of granting the relief sought. * * * A court of chancery may, in a case in which the rules and principles of equity demand it, condition the grant of relief sought from it by a complainant with the enforcement of a claim or an equity held by a defendant; which, by reason of the statute of limitations or otherwise, the latter could not enforce in any other way.”

In DeWalsh v. Braman, supra, Braman filed a bill in equity alleging that he was the equitable owner of certain lots and that the legal title was in DeWalsh in trust for him. He prayed for a decree finding the legal title to be in him and compelling a conveyance of that title to him. The answer alleged the expenditures of money by DeWalsh in the improvement of the lots with a dwelling house built at Bramam’s request, and offered to make a conveyance on repayment of said expenditures. The chancellor refused to allow said expenditures to DeWalsh and entered a decree as prayed in the bill. One of the questions involved was whether DeWalsh ivas entitled to these expenditures because of the statute of limitations. In reversing the decree our Supreme Court said (p. 420):

“Can appellee now compel a conveyance in a court of equity from appellant before he shall have reimbursed appellant for such improvements, even though, were appellant asldng affirmative relief or attempting to recover in an action at law, his debt would be barred by the statute of limitations? It may be conceded that at the time of the filing of this bill by appellee, appellant was in no position to have maintained a suit at law on his indebtedness, for the reason that a plea of the statute of limitations would have been a defense. * * * It may be conceded further that the equitable rights or relief asked by appellant in his answer would not have been granted him by a court of equity, were he, at its bar, himself asking affirmative relief. Under the principles and doctrines of equity, however, before the complainant can get from the court the relief asked for by him, he must secure to the defendant that to which he is justly entitled by the principles and doctrines of equity. * * * ” (p. 422) “It is insisted by appellee, however, that the statute of limitations was a bar to any relief of this' character. The statute of limitations does not strictly apply to cases in equity. It is true that equity generally follows the law, and the period that the statute requires to bar an action at law is in equity called laches. (Greenmm v. Greenman, 107 Ill. 404.) The strict construction that is given the statute in actions at law is not always favored in con ids of equity, and mere lapse of time, however great, will not bar a recovery if an excuse for the delay in enforcing the remedy be given which appeals to the conscience of the chancellor, and is such as would render it inequitable that the bar should be interposed. (Harris v. McIntyre, 118 Ill. 275.) * * * ” (p. 423) “We have found that this indebtedness was due to appellant, and while it may or may not have been barred in an action at law or for affirmative relief by him, still, in an action against him seeking to compel a conveyance of this property the title to which he held, the maxim that ‘he who asks equity must do equity’ is applicable, and should have been enforced. ’ ’

We do not think there is any merit in counsel’s second contention, viz., that the Dock Company’s claim of subrogation is inconsistent with its position originally taken in the litigation. In such a case as the present one the equitable right of subrogation arises because of the fact that the security which was given in good faith is found to be invalid. One of the purposes of the doctrine is the preventing of injustice which would arise when a lender’s money is used for the purpose of satisfying a prior lien, and the security taken by him, intended to be a first lien, is found to be invalid or inferior to another lien. And the mere fact that the Dock Company’s original bill proceeded on the theory that the trust deeds given by Conkling were valid first liens, and the Dock Company sought to foreclose them, should not estop it from subsequently asking to be subrogated to the rights of a holder of a. valid mortgage which its money had paid. The Dock Company simply misapprehended the law. In Sutter v. People’s Gas Light & Coke Co., 284 Ill. 634, 640, it is said (quoting from Holcomb v. Boynton, 151 Ill. 294):

“It is a novel idea in the law of estoppel that the doctrine should be applied to a person who has been guilty of no fraud, simply because under a misapprehension of the law he has treated as legal and valid an act void and open to the inspection of all. ’ ’

Counsel’s third contention is, that to allow subrogation would permit the Dock Company “to do indirectly what the Supreme Court has said it cannot do directly.” In support of the contention counsel cite the case of North Ave. Building & Loan Ass’n v. Huber, 270 Ill. 75. In that ease Kemper, the treasurer of the association, made a loan to Christina and John Huber, secured by a trust deed in which certain real estate was conveyed to Kemper, as trustee. The association purchased the loan from Kemper, and subsequently the association and Kemper, as trustee, filed a bill to foreclose the trust deed. Christina Huber made the defense that the loan was ultra vires the association, because it could only loan money to its members and stockholders and the Hubers were not such. By an amended bill the association asked that, if the transaction should be held to be ultra vires, the legal title to the note should be held to be in Kemper for the use of the association as the “equitable owner” of the note and trust deed and that the trust deed should be foreclosed. A decree of foreclosure was entered, on the theory that Kemper had a right to foreclose the trust deed but that he was to be required to account to the association for the proceeds received from the foreclosure sale. The Supreme Court held that the attempted purchase of the note and trust deed by the association was unauthorized and ultra vires, and reversed the decree and remanded the cause without any specific directions. The court said in its opinion (p. 82, italics ours):

“The association is in a court of equity ashing equitable relief. Its alleged right to claim such relief grows out of its attempt to do an act which it had no authority to do. If it should be held, as insisted upon, that by the transaction the association became the equitable owner of the securities while the legal title still remained in Kemper, as 'trustee, for its use, and that by the transaction it became entitled to a foreclosure of the trust deed, it would establish a rule that the association could do indirectly what it is prohibited by law from doing directly. It is true, the Hubers have never paid the note and their moral obligation to pay it may be unaffected by the defense here interposed, but that would not justify holding the association is entitled to enforce payment by the remedy here sought to be pursued. Whatever the remedy of the association may be, we do not think it is, by way of foreclosure in a court of equity. As said in National Home Building Ass’n v. Bank, supra” (181 Ill. 35, 48): ‘No action can be maintained upon the unlawful contract, and in such cases, if the courts can afford any remedy, it cannot be done by affirming or enforcing the contract, but in some other mawner.’ See also Central Transportation Co. v. Pullman’s Palace Car Co., supra.” (139 U. S. 24, 60.)

From this Huber case it clearly appears that the building association was the actor and was attempting to enforce a security under the guise of an equitable title to the same, which could not be enforced under a legal title; in other words, it was attempting to enforce an unlawful contract indirectly which it could not do directly. This, the Supreme Court said, should not be allowed. But the court, as we read the decision, only decided that said association could not ask the aid of a court of equity in enforcing a security which was based upon an unlawful contract. The court strongly intimated that it had other equitable rights and remedies. In the present case, the Dock Company, under its defense of subrogation, is not now seeking to enforce that portion of a contract which the Supreme Court in the foreclosure case (273 Ill. 318) declared to be unlawful; on the contrary it is resisting the claim of Davis, trustee, to certain moneys now in its possession, acquired in good faith and supposedly lawfully, which moneys in equity and good conscience, as it seems to us, Davis, trustee, is not entitled to, but which the Dock Company is entitled to retain. The Huber case was before the Supreme Court a second time. (286 Ill. 375.) From this second opinion it appears that after the case had been re-docketed in the circuit court, the executors of Kemper, he having died, asked leave to amend the foreclosure bill by dismissing the building association and making other corrections in the bill to conform to the changed situation, for the purpose of finally determining the rights and equities of the estate of Kemper in the premises. The trial court denied the motion, on the ground that the questions involved had been fully adjudicated by the Supreme Court, and dismissed the original amended bill. This order was affirmed by the Appellate Court but was reversed by the Supreme Court and the cause was remanded with directions to allow the amendments and for further proceedings.

As we read the opinion of our Supreme Court in the foreclosure case (273 Ill. 318) it was decided that the transaction, as to part of the loan, viz., $35,000, was void, but that the trust deeds were valid as to $15,000, the purchase price for Block 139, and were subject to foreclosure for that amount, interest, costs and expenses. And the cause was “remanded to the circuit court for further proceedings not inconsistent with the views expressed in this opinion.” And we do not think that the opinion means that the Dock Company could not recover against Conkling (if he was not a bankrupt but able to respond) in an action for indebitatus assumpsit, or that, having by virtue of the foreclosure sale and the subsequent sale to Gorton repossessed itself of its money, it should be compelled under the facts of this case to make restitution thereof to Davis, trustee, who stands in Conkling’s shoes and has no greater rights. Under such an order of remandment, after the case was redocketed and Davis, trustee, had filed his petition for restitution, we think that the Dock Company had the right to set up in defense any equitable right it had. (Chickering v. Failes, 29 Ill. 294, 303; Board of Trade v. Nelson, 162 Ill. 431, 437.) Furthermore, restitution is not always a matter of absolute right. While it is the law that when a judgment is reversed the parties are to be restored to their original rights so far as it can be done without prejudice to third persons (McJilton v. Love, 13 Ill. 486, 495; Ure v. Ure, 223 Ill. 454, 463), still it will be noticed that in the present case Davis, trustee, did not ask to be restored to his original rights but sought by his amended petition for restitution a money recovery from the Dock Company. In 18 Encyc. PI. & Pr. p. 875, it is stated that “in a large number of cases it is held that restitution is not always of right, and while it is usually granted on a reversal of a judgment, unless there is something peculiar in the case, the court, in its discretion, may refuse it where justice and propriety do not call for it.” In Green v. Stone, 1 Har. & J. (Md.) 405 (referred to with approval in Major v. Collins, 17 Ill. App. 239, 245), it is said (p. 408): “The court are also of opinion that the plaintiff cannot recover in this case unless the defendant’s retaining the money is contrary to equity and right; that the defendant may resort to any equitable or conscientious defense to repel the claim of the plaintiff, and may show the justice of his original claim.” In Gould v. McFall, 118 Pa. St. 455, 456, it is said: ‘ ‘ Restitution is not a mere right. It is ex gratis, resting in the exercise of a sound discretion, and the court will not order it where the justice of the case does not call for it, nor where the process is set aside for a mere slip.” (See also Teasdale v. Stoller, 133 Mo. 645, 652; Alden v. Lee, 1 Yeates [Pa.] 207, 208; Green v. Brengle, 84 Va. 913, 916; State v. Horton, 70 Neb. 334, 341; Carroll v. Draughon, 173 Ala. 338, 346, reversing Ex parte Walter, 89 Ala. 237.) We think, therefore, that the third contention of counsel for Davis, trustee, above mentioned, is under the facts of the present case without merit.

Counsel for the Dock Company also contend that, although our Supreme Court has decided that the loan of $35,000 was ultra vires and the trust deeds to that extent were unenforceable in the foreclosure suit, still those facts do not operate to give Conkling’s trustee in bankruptcy the right tó recover said $35,000 in this proceeding. The argument is that, if Conkling was not a bankrupt but able to respond, the Dock Company could recover of Conkling said amount with interest either in an action at la,w or in equity; and that, Conkling being a bankrupt and said sum having been returned to the possession of the Dock Company by reason of a sale of the property on July 3, 1914, then presumably lawful and made in good faith, Conkling’s trustee in bankruptcy cannot recover it back under the petition for restitution, and for the reáson that said sum in equity and good conscience belongs to the Dock Company, and not to Conkling or his creditors, and the Dock Company is entitled to retain it. We think there is considerable force in the contention and in the argument. The equities of this case are certainly with the Dock Company.

In Leigh v. American Brake-Beam Co., 205 Ill. 147, 152, it is said:

“Although a party is not liable to pay according to a contract which is ultra vires, that fact is not permitted to work injustice where the law can afford a remedy without enforcing the illegal contract, and the courts will give relief where it can be given independently of the contract. It would be unjust to hold that one who has received money or property under a contract which is ultra vires need not account for it because the contract was illegal, but the law implies a contract to return what has been received. Where a contract is not malum in se of malum prohibitum, and it has- been executed or benefits have been received, the party benefited, whether the. corporation or individual, will not be permitted to retain the fruits of the transaction without compensation. * * * Where a contract is ultra vires, and a corporation has received money under it which in equity and good conscience belongs to another and which it ought fo pay over, it is liable for it in an action for money had and received, with interest after demand. (Brennan v. Gallagher, 199 Ill. 207.) The converse of the proposition is equally true, and an action for the recovery of the money would not enforce or affirm the original contract, but would disaffirm it.”

In Central Transp. Co. v. Pullman’s Palace Car Co., 139 U. S. 24, 60, it is said:

“A. contract ultra vires being unlawful'1 and void, not because it is in itself immoral, but because the corporation, by the law of its creation, is incapable of making it, the courts, while refusing to maintain any action upon the unlawful contracts, have always striven to do justice between the parties, so far as could be done consistently with adherence to law, by permitting property or money, parted with on the faith of the unlawful contract, to be recovered back, or compensation to be made for it. ’ ’

Counsel for the Dock- Company further contend that the Dock Company, in equity and good conscience, should be allowed to retain so much of the amount bid by it at the master’s sale as represented the value of the strip of land known as Erie avenue.

It appears from the evidence introduced in the original foreclosure suit (which by agreement of counsel was to be considered by the chancellor on the hearing of the petition for restitution) that Erie avenue had been dedicated as a street by the Dock Company as early as 1875; that in January, 1909, the Dock Company sold Block 139 to Conkling for $15,000 and loaned him $35,000 in addition; that to secure said purchase price and said loan Conkling executed the trust deed of January 22, 1909, on Blocks 138 and 139; that in June, 1911, the Dock Company vacated as a public street that portion of Erie avenue, lying between Blocks 138 and 139, being 80 feet wide, about 450 feet long, and containing about 36,000 square feet; that on June 19, 1911, it conveyed by quitclaim deed, “in consideration of $10 and other good and valuable considerations,” said portion of Erie avenue, and on the same day Conkling executed and delivered a second trust deed on said strip of land as additional security for Conkling’s notes for $50,000; that the real consideration for said transaction was the existence of a supposedly valid trust deed securing said notes for $50,000; that while there was no specific testimony as to the value of said strip there was testimony that the land in Block 138, immediately adjoining said strip, was reasonably worth at the time from 30 to 40 cents per square foot, and that the acquisition of said strip, by connecting' Block 138 and Block 139 and making one piece of the entire property, enhanced the value of the property for manufacturing purposes; that said strip of land was included in the master’s sale, July 3, 1914, to the Dock Company and in the master’s certificate of sale; and that it was also included in the master’s deed to Gorton on November 2, 1915, the time when Gorton paid the sum of $72,600.17 to the Dock Company.

Counsel’s argument is in substance that, by reason of these facts and the fact that the real consideration for the transaction as to said strip was the existence of a supposedly valid mortgage securing said $50,000 indebtedness which was finally decided to be invalid as to $35,000, the consideration for the ^transfer of said strip to Conkling largely failed, and the Dock Company should be considered the equitable owner of said strip, and be allowed to retain out of the moneys received at the master’s sale the value of said strip at the time óf said transaction, as shown by the evidence, viz., 36,000 square feet at 30 cents per foot, or $10,800.

Under the peculiar facts of the present case, we think that the Dock Company has an equity in said strip of land, known as Erie avenue, as against Davis, trustee, and in this proceeding for restitution should be allowed the reasonable value thereof, as shown by the evidence. The portion of the loan which was held void by our Supreme Court was $35,000. We have above held that of this amount the Dock Company in this proceeding should be allowed to retain $30,215.86, on account of its right to be subrogated because of the payment of the note secured by the Hagey mortgage. Therefore, Davis, trustee, in our opinion, is not entitled to recover from the Dock Company in this proceeding any part of the proceeds of the master’s sale of July 3, 1914.

Counsel for the Dock Company also contend that the court erred in entering the decree appealed from; (a) because Davis, trustee, was not entitled to interest upon the amount found due at the date of the sale, July 3,1914, to the date of the decree; (b) because the bankruptcy of Conkling would prevent an order of restitution; (c) because Davis, trustee, had no right to restitution, but that his remedy, if any, was against the property; and (d) because neither Conkling nor his trustee in bankruptcy had a right of election to affirm the sale. All these contentions have been elabr orately argued, but in view of our holdings above set forth we deem it unnecessary to discuss them.

In the writ of error case, No. 25,318, which was con-" solidated for hearing with this appeal case, No. 25,144, it is contended by counsel for Leverett Thompson and Thomas Carroll Neal, as trustee, that the court erred (1) in refusing to allow said Thompson and Neal leave to file its verified petition on January 11, 1919, the day the decree in question was entered, and (2) that the decree as entered was erroneous in that it ordered the Dock Company to pay to Davis, trustee, certain moneys to the exclusion of the rights of Thompson, the holder of Conkling’s unpaid note for $11,000, secured by Conkling’s conveyance to Nea.l in October, 1910, and Neal’s declaration of trust. The petition, which the court refused to allow to be filed, alleged in substance that the rights of the petitioners to any portion of the purchase price received at the master’s sale under the foreclosure decree were paramount to the rights of Davis, trustee, ‘£ and of any other person except the Dock Company,” and that, in the. event it should be decreed that the Dock Company was not entitled to retain all of said purchase price, Thompson as the owner of said note was entitled to be paid out of the amount the Dock Company might be required to pay, ahead of Davis, trustee, the amount of said note and interest. Without entering into a discussion of these contentions, suffice it to say that we are of the opinion under all the facts in evidence that (1) the court, having decided to enter the decree it did, abused its discretion in not allowing said petition to be filed, particularly so as it appears that as late as January 3, 1919, Davis, trustee, filed an amendment to his amended petition -for restitution, and it does not appear that either Thompson or the former holder of said unpaid note, Central Trust Company, had received a proper notice of the filing of said amendment; and that (2) the court erred in holding that the rights of Davis, trustee, to any portion of the moneys in the hands of the Dock Company received from said sale of July 3, 1914, were superior to the rights of Thompson, as holder of said unpaid note, secured as aforesaid. But in view of our holdings, above set forth, as to the rights of the Dock Company to subrogation and its other equitable rights, this opinion is not important. Neal in his declaration of trust declared that, by virtue of the quitclaim deed from Conkling to him, he held title to Blocks 138 and 139 in trust to secure the payment of said $11,000 note, but ££ Subject to an incumbrance of $50,000.” This refers, of course, to the trust deed given by Conkling to Nelson, trustee, on said Blocks, dated January 22, 1909, to secure Conk-ling’s notes for $50,000, and which trust deed was foreclosed by the decree of June 5,1914, to which foreclosure suit Neal and the Central Trust Company, the then holder of the $11,000 note, were parties, and in which foreclosure. decree the court found that their rights were subject to said trust deed. Our Supreme Court has held that said trust deed was a valid lien “as security for $15,000; * * * and subject to foreclosure.” And under thé facts of the present case we think that the equitable-rights of the Dock Company, above mentioned, to the proceeds of said foreclosure sale of July 3, 1914, are superior to the rights of Neal and Thompson in such a proceeding as the present one.

Our conclusion is that the decree of the circuit court, entered January 11, 1919, should be reversed, and the cause should be remanded with directions to dismiss for want of equity the amended petition of Abel Davis, trustee, etc., for restitution, and it is so ordered.

Reversed and remanded with directions.

Mr. Presiding Justice Matchbtt and Mr. Justice Barnes concur. , '  