Young, C. J.
This is an action to compel the specific perform■ance of the written contract of defendant Coe to sell and convey to the plaintiff a certain eighty-acre tract of 'land situated in Ram•sey county, and to cancel and declare void a deed of conveyance of said land executed and delivered by said Coe to the defendant Me‘Devitt after he had entered into the contract to convey the same to the plaintiff. The plaintiff alleges, in substance, that the land in ■question was formerly owned by Nettie Coe; that upon her death, which occurred on April 28, 1900, the defendant Alfred N. Coe, ‘her husband, was appointed administrator of her estate, and has since acted as such; that said estate does not exceed in value the ■sum of $5,000, and no claims ■ have been filed against it; that the said defendant Alfred N. Coe is the sole heir of said deceased, .and entitled to a decree from the county court conveying to him .all of the property of decedent, including these premises; that the -administration of the estate has not been completed, in this r that the ■final decree of distribution of said estate, formally assigning the .above real estate to the defendant Alfred N. Coe, has not been made; that on April 24, 1901, the plaintiff and the defendant Alfred N. Coe, entered into a written contract, through correspondence, wherein the plaintiff agreed to purchase and the defendant Coe agreed to ;sell to the plaintiff the land in question, and convey the same upon :a good and sufficient deed upon said Alfred N. Coe receiving from "the plaintiff the sum of $475, and that by the terms of said contract the plaintiff received possession of the premises, and was to have clear title upon the county court issuing its decree vesting title in defendant Alfred N. Coe; that in pursuance of said con*509tract the plaintiff took possession and prepared part of the land for crop, and that he has ever since been in the open possession-of the same, and has at all times been ready and willing to pay the said sum of $475 upon the delivery of a good and sufficient deed of. conveyance; that thereafter, and with full knowledge of the above contract and of plaintiff’s possession thereunder, the defendant John McDevitt purchased said land from said Coe, and received a warranty deed therefor, which said deed the defendant caused to-be placed of record; that the said McDevitt claims to own said land, and threatens to take forcible possession thereof. Pla,intiff prays that the contract made by defendant Coe may be specifically performed; that the deed of conveyance delivered by Coe to McDevitt be declared null and void, and be canceled of record;. and for general equitable relief. The defendant Coe was served, but did not answer. McDevitt, answering for himself, in addition, to a general denial, alleges that in May, 1901, relying upon the apparent ownership of Coe of the premises, and on the advice of an attorney that Coe could give a good title, he purchased the same, and received a good and sufficient deed of conveyance, and paid-therefor the sum of $525 in cash; that he paid the delinquent taxes upon the premises, and on the 10th day of June, 1901, caused his-deed to be recorded, and upon receiving his deed entered into possession, and has ever since been in the sole, open, and complete-possession thereof; that he has made valuable, permanent improvements thereon to the value of at least $800, and is still in possession. He further alleges that the plaintiff is not, and never has-been, in possession of the premises; that Coe was in po-ssessionup to the time of the latter’s conveyance to him; and that this defendant, up to the time of receiving his deed, had no notice whatever of any claim on the part of the plaintiff, or that he had or pretended to have any interest or estate in said premises. The trial court found that the facts alleged in the complaint and above set out were true, and, in addition, the court found that the defendant Coe, pursuant to his contract' with plaintiff, delivered to the Ramsey county bank a warranty deed, which deed was made out to F. E. Merrick for the purpose of securing the payment by the plaintiff to the said F. E. Merrick of the sum of $475, which the latter had agreed to advance to him to pay for said land, and that, for the reason that the said Coe had not completed the probate of the estate, the said deed, with the knowledge and consent of *510defendant Coe, was to remain in the Ramsey County Bank until the final decree was issued by the county court; that the defendant McDevitt, when he purchased said land, had knowledge that the plaintiff had contracted for the purchase of the same, that he was in possession thereof, and had prepared a part of it for crop. The trial court also found that since the date of his purchase the defendant McDevitt has erected improvements thereon, consisting of .a house, barn, granary, and well, of the value of about $1,400; that they were made after the plaintiff’s contract of purchase, and with knowledge on the part of the defendant McDevitt that plaintiff had purchased said land, and was in possession thereof. As conclusions of law the trial court found that plaintiff is entitled to judgment declaring that he is the owner and entitled to the possession of the premises; that the deed from Coe to McDevitt be adjudged void, and canceled of record; further, that the plaintiff foe required to deposit in the Ramsey County Bank the sum of $475, payable to the order of Alfred N. Coe, less the sum of $54.30, costs and disbursements heretofore taxed, and that upon said deposit being made the plaintiff is entitled to receive and record the deed executed by Coe to Merrick for the benefit of the plaintiff; further, that plaintiff is authorized to obtain a decree from the county court vesting title in Coe as the sole heir; that upon the performance of the foregoing conditions the decree shall operate as a transfer of all interests of both defendant Alfred N. Coe and John McDevitt to F. K Merrick for the benefit of the plaintiff, James Hunter. From the judgment entered in accordance with the foregoing conclusions, the defendant McDevitt has appealed to this court, and demands a review of the entire case, under the provisions of section -5630, Rev. Codes 1899.
Three propositions are urged in this court by counsel for the appellant as grounds for reversing the decree. It is contended (1) that McDevitt was a bona fide purchaser for value, with neither actual nor constructive notice of Hunter’s rights; and (2) that, in any event, the decree should provide for the payment of the purchase price by Hunter to this appellant, instead of to Coe; and (3) that the improvements were erected by McDevitt in good faith, and the decree should therefore require Hunter to render compensation therefor to McDevitt. In our opinion, the evidence does not sustain appellant’s contention that he purchased without either actual or constructive notice of Hunter’s contract. Section 3594, *511Rev. Codes 1899, protects a purchaser “in good faith and for a valuable consideration whose conveyance is first duly recorded.” It is true defendant is a purchaser for a valuable consideration, and his conveyance was first placed of record, but that is not enough to secure the protection of the statute. He must also be a purchaser in good faith. “Good faith” is defined by section 5114, Rev. Codes 1899, -as follows: “Good faith consists in an honest intention to abstain from taking any unconscientious advantage of another even through the forms or technicalities of law together with an absence of all information or belief of facts which would render the transaction unconscientious.” Our conclusion that McDevitt is not a purchaser in good faith does not rest on notice from possession. In our opinion, the evidence wholly fails to show any acts of open and visible possession by plaintiff sufficient to constitute notice of his rights. The evidence does show, however, that he had notice of Hunter’s contract before he purchased. It may be doubted whether he had actual notice — or, in other words, express information — of the existence of the contract or its terms, but it is entirely clear that he had constructive notice, and that is its equivalent, and defeats his ■contention that he was a purchaser in good faith. Section 5118, Rev. Codes 1899, defines constructive notice as follows: “Every person who has actual notice of circumstances sufficient to put a prudent man upon inquiry as to a particular fact, and who omits to make such inquiry with reasonable diligence, is deemed to have constructive notice of the fact itself.” Upon the facts of this case we must hold that the defendant was under obligations to make inquiry as to Hunter’s rights, and must be held to have known what that inquiry would have developed. He was informed by a number of persons that Hunter had bought the land. Among others, one Olson, to whom Hunter attempted to rent it, told him that Hunter had bought it. The defendant, himself testified that he had heard a week or ten days before he got his deed that plaintiff claimed an interest in the land. It is well settled that one who takes a ■deed of land with knowledge of an outstanding contract or title takes it subject to such contract or title. The purchaser with notice merely stands in the place of his vendor, and may be compelled in an action of specific performance to convey upon the terms of the outstanding contract. As was said by Chancellor Kent in Champion v. Brown, 6 Johns. Ch. 402, 10 Am. Dec. 343: “If A enters into a contract to sell land to B, and afterwards refuses *512to perform his contract, and sells the land to C for a valuable consideration, B may by bill compel the purchaser to convey to him, provided he be chargeable with notice at the time of his purchase-of B’s equitable title under the agreement.” It was further said in that case that: “The rule that affects the purchaser is just as-plain as that which would entitle the vendee to a specific performance against the vendor. If he be a purchaser with notice, he is liable to the same equity, stands in his place, -and is bound to-do that which the person he represents would be bound to do by the decree.” In Fry on Specific Performance, section 218, p. 102, the rule is laid down that: “Where a contract has been entered.into-for the sale of property, and that property is afterwards aliened or assigned, or contracted to be aliened or assigned, and the alienee or assign has notice of the original contract, he is liable to' its performance at the suit of the purchaser.” See cases cited in-note 1; also, McCone v. Courser (N. H.) 15 Atl. 129; Patten v. Moore, 32 N. H. 382; Caldwell v. Carrington's Heirs, 9 Pet. 86, 9 L. Ed. 60; Dickerson v. Dickerson (Neb.) 42 N. W. 9.
The case is one, therefore, in which the remedy by specific performance may properly be invoked. But it does not follow that plaintiff’s right to a decree is absolute, for it is well settled that: “The specific performance of a contract of sale rests largely in the sound discretion of the court upon a view of all the circumstances.”' Benson, Adm’x, v. Cutler, 53 Wis. 107, 10 N. W. 82; Williams v. Williams, 50 Wis; 311, 6 N. W. 814; Taylor v. Longworth, 14 Pet. 172, 10 L. Ed. 405. The court may grant or refuse this-remedy, or impose conditions for granting it, in the exercise of a sound discretion, according- to the equities peculiar to each case. In our qpinion, the facts in this case do not entitle the plaintiff to-an unconditional decree, nor sustain the judgment which was entered. In the first place, the judgment provides that the plaintiff shall pay to Coe the unpaid purchase price of $475. This is clearly erroneous. There is nothing due to Coe. He transferred all his title and interest to the defendant McDevitt, and was succeeded by him as the-holder of the legal title. Coe cannot transfer the title, because he has none, having parted with it by the delivery of a' deed to the-defendant McDevitt. Under his contract with the plaintiff Coe was: to receive $475 for the land. He has in fact received $525 for the-conveyance of the title to the defendant McDevitt. We are not able-to understand on what theory Coe should be rewarded for his: *513duplicity by being paid for the land twice. We certainly know of no principle of equity which will sustain this part of the decree. McDevitt, having obtained the legal title with constructive notice of the plaintiff’s contract, is bound by it and may be compelled to convey to the plaintiff. In other words, he is bound to perform the contract which his grantor was bound to perform by reason of the knowledge imputed to him. It is equitable that he should do so, but it is also just that the plaintiff, as a condition to obtaining McDevitt’s title, shall perform his part of the obligation, by paying to the defendant McDevitt, Coe’s successor, the consideration which, under the contract, was to have been paid to Coe. It is clear that the purchase money belongs to the defendant McDevitt, and the decree must so provide. See Veith v. McMurtry (Neb.) 42 N. W. 6.
We are also of opinion that the judgment is erroneous in not requiring, as a condition for relief, that plaintiff reimburse Mc-Devitt for the permanent improvements placed upon the land by him prior to the service of the summons and complaint in this action. The contract which plaintiff seeks to have enforced called for the land without improvements. Under the decree he gets not only the land which he bargained for, but also permanent improvements made by McDevitt, which the trial court found to be approximately of the value of $1,400, and this upon payment of only $415, and that sum to be paid not to McDevitt, but to Coe, who has already heen paid for the land. The theory on which the improvements were awarded to the plaintiff undoubtedly was that they were placed on the premises by the defendant in bad faith. It seems to have been assumed that, if the defendant was not a good-faith purchaser within the meaning of the recording act, he could not have made the improvements in good faith, and therefore would not be entitled to an allowance for them. This by no means follows. One is not a purchaser in good faith, so as to be protected against an outstanding contract, who has constructive notice of such contract; and this because the law itself imputes, in the case of constructive notice, knowledge to him. But one may honestly believe that he has good title when in fact he has not, and, while this belief will not avail him as against an outstanding contract or title of Avhich he has constructive notice, he will nevertheless be entitled to be protected in his permanent improvements, for the test of good faith as to them is his honest belief that he has good *514title. See Parker v. Vinson, 11 S. D. 381, 77 N. W. 1023; Meadows v. Osterkamp, 13 S. D. 571, 83 N. W. 624; Green v. Dixon, 9 Wis. 532; Thompson v, Thompson, 16 Wis. 94; McLaughlin v. Barnum, 31 Md. 425. What are the facts? It is entirely clear that the defendant honestly believed that by obtaining a deed from Coe and having it recorded he had acquired perfect title. In this he was mistaken, because the law would not permit him to retain the title as against the plaintiff under the circumstances which here exist, but that does not alter the fact that the defendant was honest in his belief. This is made plain by his conduct, which speaks with more convincing effect than any oral testimony. In the first place, he is a man of moderate means. He paid $525 cash for the land. He immediately recorded his deed, paid the delinquent taxes, entered upon the land, dug a well- at an expense of $45, erected a barn with a stone foundation at an expense of $225, built a granary at an expense of $275, and a house which cost $850, put in a crop, and fenced the uncultivated land. These were acts of possession and ownership of open and visible character. The plaintiff is a farmer, and resides 160 rods from the land in question. He passed by it frequently, and also saw the defendant at numerous times while the improvements were being made. Plaintiff must have known that defendant believed his title was good, and that he was making these improvements in reliance upon the title which he had acquired by his purchase, and yet they were all' made without a single word of objection from the plaintiff. Indeed, the record fully warrants the conclusion that the plaintiff purposely delayed the assertion of his rights under the contract by the institution of this action until these valuable improvements were almost -completed. The testimony shows that the improvements were practically all made in the months of June and July. The summons and complaint in this action bear date June 11th. They were not served, however, until July 15th, more than a. month after they were drawn. We have held that bad faith will be imputed to the defendant in making his purchase without making inquiry as to plaintiff's contract, and for the same reason we must hold under the facts in this case, that the plaintiff was guilty of actual bad faith in permitting and acquiescing in the making of the improvements by defendant directly under his observation without a single word of protest. Not only was plaintiff at fault in not notifying defendant of his rights under the contract when it be*515came his duty to do so, that is, when the improvements were being made with his knowledge, but he was equally negligent in the performance of his obligation under the contract. It was not until the 17th of June that the plaintiff made a deposit in the Ramsey County Bank, in which the deed from Coe had been left by the latter on the 1st of May. preceding. The deposit then made was a conditional one, and the money was advanced by one F. E. Merrick ; the condition being that the money might be paid over upon the completion of the administration proceedings by Coe.. This was after the summons and complaint in this action were drawn. Had the plaintiff, even at the time of commencing the improvements, made inquiry, he would have found Coe’s deed to Merrick lying in the Ramsey County Bank, and no deposit to cover the purchase price. It is not too much to say that, had McDevitt had actual knowledge of all the facts obtainable by inquiry prior to the deposit on June 17th, he might well have honestly doubted the plaintiff’s intention to take the land. But, be that as it may, we are entirely clear that the plaintiff should not be permitted, in a court of equity, to profit by his own bad faith in permitting the defendant to make the improvements without protest. The plaintiff is asking the aid of a court of equity to protect him in an equitable right in land as against the holder qf the legal title. The rule applicable to the facts as they exist in this case is “that, if the equitable owner of land, who is conusant of his right to it, will stand by and see another occupy and improve the property without asserting his right to it, he shall not in equity enrich himself by the loss of another which it was in his power to have prevented, but must be satisfied to recover the value of the land independent of the improvements. The acquiescence of the owner in the adverse possession of a person whom he found engaged in making valuable improvements on the property is little short of a fraud, and justifies the occupant in the conclusion that the equitable claim which the owner asserts has been abandoned.” Southall v. McKeand, 1 Wash. (Va.) 336; Green et al v. Biddle, 8 Wheat. 78, 5 L. Ed. 566. In 3 Pom. Equity Juris., section 1241, it is said that: “Where a party innocently and in good faith; though under a mistake as to the true condition of the title, makes improvements or repairs or other expenditures which permanently increase the value of the property, so that the real owner, when he seeks the aid of equity to establish his right to the property itself, or *516to enforce some equitable claim upon it, having been substantially benefited, is required upon principles of justice and equity to repay the amount expended.” So, also, in Neeson v. Clarkson, 4 Hare 97,' it is said that: “Whenever it is necessary for the true owner himself to proceed in equity, the principle that he who seeks equity must do equity will be applied, and he will only be entitled to the aid of the court upon making compensation for the outlays. In pursuance of this doctrine, when a person in peaceable possession under a claim of lawful title, but really under a defective title, has in good faith made permanent improvements, the true owner, who seeks the aid of equity to establish his own title, will be compelled, as has been held, to reimburse the occupant for his expenditure.” Robinson v. Ridley, 6 Madd. 2; Atty. Gen. v. Baliol Coll., 9 Mid. 407, 411; Bright v. Boyd, 1 Story 478, Fed. Cas. No. 1,875; Id., 2 Story, 605, Fed. Cas. No. 1,876; Rathburn v. Colton 15 Pick. 471; Miner v. Beekman, SO N. Y. 337; Smith v. Drake, 23 N. J. Eq. 302; McLaughlin v. Barnum, 31 Md. 425; Sale v. Crutchfield, 8 Bush, 636; and see Preston v. Brown, 35 Ohio St. 18. So, also, it is said in 1 Story, Equity Juris, section 388: “If a man, supposing he has an absolute title to an estate, should build upon the land with the knowledge of the real owner, who should stand by and suffer the erections to proceed without giving any notice of his own claim, he would not be permitted to avail himself of such improvements without paying a full compensation therefor; for in conscience he was bound to disclose the defect of title to the builder. Nay, a court of equity might, under circumstances, go further, and oblige the real owner to permit the person making such improvements on the ground to enjoy it quietly and without disturbance.” See, also, sections 385, 799a, 799b, 1237, Id. Putnam v. Ritchie, 6 Paige, 390, a leading case, the doctrine of which has been uniformly approved laid down the rule that: “Where industrial acquisitions have been made to property in good faith by a person who has the legal title to the property, so that the real owner is compelled to resort to a court of chancery to assert his equitable title to such property, this court acts under the civil-law rule of natural equity, and compels the complainant to compensate the adverse party for such industrial acquisitions or improvements as a condition of granting the equitable relief asked for in the suit.” As instances in which courts of equity have exacted reimbursement for improvements as a condition of granting equitable relief, the following *517cases will be found instructive, and fully sustaining our conclusion: Leeds v. Penrose, 44 N. J. Eq. 464, 15 Atl. 261; Miner v. Beekman, 50 N. Y. 337; Thomas v. Evans, 105 N. Y. 601, 12 N. E. 571, 59 Am. Rep. 519; Poole v. Johnson, 62 Iowa, 611, 17 N. W. 900; Gilbert v. Peteler, 38 N. Y. 165, 97 Am. Dec. 785; Smith v. Drake, 23 N. J. Eq. 302; Freichnecht v. Meyer, 39 N. J. Eq. 551; Parsons v. Moses, 16 Iowa, 444; Wetmore v. Roberts, 10 How. Prac. 51; Williams v. Gibbs, 20 How. 535, 15 L. Ed. 1013. The basis of all these decisions is the familiar and wholesome maxim that he who seeks equity must do equity. In many cases it is difficult to determine whether the allowance should cover the cost of the improvements or merely the amount they enhance the value of the estate. In this case we have no such embarrassment. The improvements, as we have seen, were made with plaintiff’s knowledge, and his silence amounted to acquiescence in the expenditures which were actually made. It is equitable, therefore, that he should be required to reimburse the defendant for the cost of such improvements as were put upon the premises prior to the service of the summons and complaint. Such improvements as were made prior to that date can fairly be said to have been made in good faith, and with plaintiff’s implied consent. After the service of the papers, the defendant proceeded at his peril and in bad faith, and is not entitled to consideration at the hands of a court of equity. McLaughlin v. Barnum, 31 Md. 425. The same equitable considerations which require that the defendant should be reimbursed for his improvements also require that he should pay a reasonable cash rental for the use of the premises during the period of his occupancy.
The condition of the record in this case, including the pleadings and the evidence, will not warrant a final judgment in this court disposing of the case according to its equities. The case must therefore be remanded to the district court for further proceedings, with leave granted to permit such amendments as shall be necessary for a final disposition of the remaining issues. The district court will set aside its judgment and order a new trial for the purpose of determining (1) the cost of the improvements placed upon the premises by the defendant prior to the service of the summons and complaint in this action; and (2) the reasonable cash rental value of the premises during the period of defendant’s occupancy. Upon the ascertainment of these facts the district court will enter judgment requiring the defendant, MeDevitt, to execute *518and deliver to the plaintiff a deed of conveyance sufficient in form and substance to convey to him all the right, title, and interest in and to said land conveyed to him by Coe upon the payment to him by the plaintiff, or deposit in court for his use, of the sum of $475 and the cost of improvements as found by the trial court, less the cash rental value of the premises, and, further, that in default of such payment or deposit by plaintiff within a period to be fixed by the district court, the action will be dismissed. Appellant will recover costs.
(97 N. W. Rep. 869.)
All concur.