The complaint alleges: In 1912 Aitkin county let a contract to defendant for the construction of a drainage ditch. Defendant was to excavate 158,545.06 cubic yards of earth, at 13 cents a ouibic yard, with stipulated amounts for bridges and othér work, making the total consideration $25,526.86. Defendant sublet the work to plaintiff, -at 9% cents a cubic yard for excavation, and the same stipulated price for bridges and other work, the consideration amounting in the aggregate -to $20,-324.14. Defendant further agreed to pay plaintiff for excavation of extra yardage required to be done by the engineer in charge 9y2 cents per cubic yard. During the progress of the work the engineer directed plaintiff to perform certain extra work, and this extra work, computed on the terms of plaintiff’s contract, amounted to $5,589.68. The county could pay, under the drainage law, for extra work, a sum not in excess of ten per cent of the original contract price. The county paid to the defendant the price specified in its contract with defendant plus ten per cent, and, in addition thereto, the sum of $600.27. Defendant paid plaintiff the price stipulated in the contract between them and -also all but $32.52 of the ten per cent that defendant received from the county for extra work. Plaintiff had, therefore, performed extra work for which it had not been paid of the value, at the price stipulated in his contract, of $3,069.54, *241and he brought a former action against defendant to recover that amount. This court held that plaintiff was entitled to recover his contract price, plus the ten per cent which defendant could under the law receive from the county, and plus also the additional $600.25 which defendant had in fact received from the county, Seastrand v. D. A. Foley & Co. 135 Minn. 5, 159 N. W. 1072, and judgment was rendered accordingly. This judgment was paid and satisfied January 1, 1917.
Thereafter the legislature of Minnesota passed a law, chapter 269, page 406, Laws of 1917, under which the county was empowered, but not required, to make payment for the unpaid portion of said extra work, and, on November 24, 1917, the county paid to defendant the sum of $4,307.13, making the full value of said extra work. This action was brought to recover from defendant the sum of $2,436.75, the balance of the value of the extra work, computed at the price per yard specified in plaintiff’s contract with defendant. The court sustained a demurrer to the complaint, holding that it failed to state a cause of action.
'The trial court was of the opinion, as indicated by a memorandum filed, that the judgment in the former action, denying the right of plaintiff to recover more than the amount above stated, is res adjudicata, and on that ground sustained the demurrer to the complaint.
1. If this were an action to recover under the terms of the original contract, it might be difficult to avoid the result arrived at by the trial court. In the former action the court construed plaintiff’s contract with defendant, and held that it did not contemplate the doing of any extra work except within the ten per cent which the county might pay under the drainage law. The determination that this was the proper construction of that contract is final and cannot again be made the subject of litigation between the parties, and the legislature could not, by subsequent enactment, change or enlarge the rights of plaintiff under the contract. State v. McDonald, 26 Minn. 145, 1 N. W. 832; King v. Dedham Bank, 15 Mass. 446, 8 Am. Dec. 112.
2. But we do not view this action as one to recover under the original contract. It is rather, as. plaintiff contends, an action to recover on the theory that, since the former judgment was rendered, defendant has received money which, in equity and good conscience, it ought to pay to plaintiff, that is, an action for money had and received. If it can be sus*242tamed on this theory the former judgment is not a bar, unless the principle on which plaintiff now seeks to recover was determined adversely to plaintiff. A party may not litigate the same cause of action twice with the same adversary. The preclusion applies to all matters which existed at the time of the giving of the judgment and which the party had an opportunity to bring before the court. But, in order that the prior adjudication shall be an estoppel, the question at issue must be the same. A judgment never affects after acquired rights nor precludes a party from availing himself of them. The judgment is conclusive only upon matters as they exist at the time of its rendition. State of Wisconsin v. Torinus, 28 Minn. 175, 9 N. W. 725. It is the receipt of money in November, 1917, long after the former judgment was rendered, that forms that basis of this action, if the complaint states a cause of action at all.
3. We think the complaint does state a cause of action for money had and received. The principles that underlie the action for money had and received have never been better summarized than they were by Lord Mansfield, in Moses v. MacFerlan, 2 Burr. 1005, in 1760. It was said, in substance, that if the defendant be under an obligation from the ties 'of natural justice to refund, the law gives the action, founded in the equity of the plaintiff’s case, as it were upon a contract (“quasi ex contractu,” as the Boman Law expresses it). This species of assumpsit, it was said, lies in numberless instances for money the defendant has received from a third person; which he claims title to, in opposition to plaintiff’s right; and which he had, by law, authority to receive from such third person. It lies for money “got through imposition (express, or implied);” or “an undue advantage taken of the plaintiff’s situation.” “In one word the gist of this kind of action is, that the defendant, upon the circumstances of the case, is obliged by the ties of natural justice and equity to refund the money.”
The best considered modem cases adhere to this broad view. In Highway Commissioners v. Bloomington, 253 Ill. 164, 97 N. W. 280, Ann. Cas. 1913A, 471, it was said that the obligation arises not from consent, as in the case of contracts, but from the law or natural equity. None of the elements of a contract are present. The intention of the parties is entirely disregarded, while in contract, express or implied, intention is of the essence of the transaction. In the case of contracts the agreement *243defineá the duty. In this class of cases “the duty defines the contract.” The right to recover, it was said, is governed by principles of equity. The action is maintainable in all cases where one person has received money or its equivalent under such circumstances that in equity and good conscience he ought not to retain it, and which ex aequo et bono belongs to another. See also Keener, Quasi-Contracts 19, 20. Substantially the same principles have been applied in this state. Brand v. Williams, 29 Minn. 238, 13 N. W. 42; Todd v. Bettingen, 109 Minn. 493, 124 N. W. 443; Heywood v. Northern Assurance Co. 133 Minn. 360, 158 N. W. 632, Ann. Cas. 1918D, 241.
There has been some disposition to narrow the application of this form of action and to limit it to the eases to which it has previously been applied. See, for example, Sergeant v. Stryker, 16 N. J. Law, 464, 32 Am. Dec. 404. But we will do well not to restrict the scope of a remedy which was intended to relieve against the too narrow procedure of the law. The remedy is now neither legal nor equitable, since under the code neither legal nor equitable remedies longer exist, but in its inception it was regarded as equitable in spirit, Dresser v. Kronberg, 108 Me. 423, 81 Atl. 487, 36 L.R.A.(N.S.) 1218, Ann. Cas. 1913B, 542, as resembling a bill in equity, Osborn v. Bell, 5 Denio, 370, 376, 49 Am. Dec. 275, as an action at law, equitable in nature, Northrop's Exr's. v. Graves, 19 Conn. 548, 50 Am. Dec. 264. As above stated, it is not necessary that there be contract, privity or promise. It is not necessary that the party from whom defendant received the money intended it for plaintiff’s benefit. Brand v. Williams, 29 Minn. 238, 13 N. W. 42.
4. In some eases there is language to the effect that the money received must be the money of plaintiff. Grand Lodge A. O. U. W. v. Towne, 136 Minn. 72, 161 N. W. 403, L.R.A. 1917E, 344. But from this it must not be understood thalt the money must have been money which plaintiff ever had or the proceeds of property or the issue of a fund which plaintiff ever possessed, Heywood v. Northern Assurance Co. 133 Minn. 360, 158 N. W. 632, Ann. Cas. 1918D, 241, or money to which the plaintiff ever had the so-called legal title. The one essential is that the money in equity and good conscience belongs to plaintiff.
5. This essential condition is fulfilled if the facts are as alleged in the complaint in this case. The fact that stands boldly out is that defendant *244has received money in payment for work which plaintiff in good faith performed and for which plaintiff has not been paid. Yet defendant retains the money. If it pays to plaintiff the amount he earned it has lost nothing, but, on the Contrary, still has a comfortable profit of $1,860.38, by reason of work done wholly by plaintiff and even without its knowledge. Thalt the county board could have contemplated that defendant should retain the whole amount and deny participation to plaintiff, who did the work, seems inconceivable. Surely an action should lie and we hold an action doe's lie.
6. The judgment in the former action did not determine that an action does not lie under this state of facts. On the contrary, it was determined, inferentially at least, that an action does lie. The item of $600.25 recovered in that action was allowed, not on the theory that the contract required it, for the court distinctly held that the contract did not require it, but on the theory that defendant had received this amount on account of the extra work done by plaintiff, and that in justice it should pay the amount over to plaintiff. We are unable to discover any distinction between the right of plaintiff to demand the item of $600.25 and his right to demand the amount later received up to the value of the work which plaintiff performed.
Order reversed.