Mr. Justice Stone
delivered the opinion of the Court.
The question for decision is whether the petitioners, testamentary trustees, who have paid a tax on the income of the trust estate, which should have been paid by the beneficiary, are entitled to recover the tax, although the government's claim against the beneficiary has been barred by the statute of limitations. The present suit to recover the tax, brought by petitioners against respondent, the Collector, in the District Court for Massachusetts, resulted in a judgment for petitioners, 8 F. Supp. 354, which was reversed by the Court of Appeals for the First Circuit, 78 F. (2d) 136. We granted certiorari because of the conflict of the decision below with that of the Court of Appeals for the Third Circuit, United States v. Arnold, 89 F. (2d) 246.
Testator, by his will, left property in trust, to pay over the net income to his wife as sole beneficiary, at such times and in such amounts as she should deem best, during her natural life. She elected to take the bequest under the will in lieu of her dower or statutory interest. At that time several circuit courts of appeals had held that in these circumstances, the income payments to the widow are annuities purchased by surrender of the dower interest and not taxable as income to her, until they equal the value of the dower interest. Warner v. Walsh, 15 F. (2d) 367; United States v. Bolster, 26 F. (2d) 760; Allen v. Brandeis, 29 F. (2d) 363. In conformity to the ruling of these decisions, the beneficiary did not include, in her 1928 tax return, any portion of the income received by her from the trust. A deficiency against the trustees was assessed by the Commissioner before, and was paid by them, under protest, from income of the trust, after collection from the beneficiary had been barred by the statute of limitations. After the statute had run, this Court held in Helvering v. Butterworth, 290 U. S. 365 (interpreting § 219, Revenue Act of 1924, c. 234, 43 Stat. 253, 275, corresponding to § 161, 162 of the Revenue Act of 1928, c. 852, 45 Stat. 791, 838, under which the present tax was assessed) that the income was taxable to the beneficiary and not to the trustees.
In the present suit, brought by the trustees to recover the tax as erroneously collected, the Collector interposed the defense, sustained by the court below, that the tax which should have been paid by the beneficiary exceeded that paid by petitioners, and that, as any recovery would inure to the advantage of the beneficiary, the defendant could set off the tax debt due from her. One judge concurred, denying the right of set off in view of the bar of the statute, but holding the petitioners not entitled, in equity and good conscience, to recover.
The action, brought to recover a tax erroneously paid, although an action at law, is equitable in its function. It is the lineal successor of the common count in indebitatus assumpsit for money had and received. Originally an action for the recovery of debt, favored because more convenient and flexible than the common law action of debt, it has been gradually expanded as a medium for recovery upon every form of quasi-contractual obligation in which the duty to pay money is imposed by law, independently of contract, express or implied in fact. Ames, The History of Assumpsit, 2 Harv. L. Rev. 53; Woodward, Law of Quasi-Contracts, § 2.
Its use to recover upon rights equitable in nature to avoid unjust enrichment by the defendant at the expense of the plaintiff, and its control in every case by equitable principles, established by Lord Mansfield in Moses v. Macferlan, 2 Burr. 1005 (K. B. 1750), have long been recognized in this Court. See Nash v. Towne, 5 Wall. 689, 702; Gaines v. Miller, 111 U. S. 395, 397; Atlantic Coast Line R. Co. v. Florida, 295 U. S. 301, 309. It is an appropriate remedy for the recovery of taxes erroneously collected, Elliott v. Swartwout, 10 Pet. 137, 156; Cary v. Curtis, 3 How. 236, 246-250. The statutes authorizing tax refunds and suits for their recovery are predicated upon the same equitable principles that underlie an action in assumpsit for money had and received. United States v. Jefferson Electric Co., 291 U. S. 386, 402. Since, in this type of action, the plaintiff must recover by virtue of a right measured by equitable standards, it follows that it is open to the defendant to show any state of facts which, according to those standards, would deny the right, Moses v. Macferlan, supra, at 1010; Myers v. Hurley Motor Co., 273 U. S. 18, 24; cf. Winchester v. Hackley, 2 Cranch 342, even without resort to the modern statutory authority for pleading equitable defenses in actions which are more strictly legal, Jud. Code, § 274b; 28 U. S. C. § 398.
In the present case it is evident that but a single tax was due upon the particular income assessed and that petitioners' demand arises from the circumstance that the tax was paid from the income by the trustees when it should have been paid by the beneficiary. If the court may have regard to the fact that so far as the equitable rights of the parties are concerned petitioners, in seeking recovery of the tax, are acting for the account of the beneficiary, it would seem clear that the case is not one in which the petitioners are éntitled to recover ex aequo et bono; for under the construction of the will by the court below, which we adopt, any recovery in this action will be income to the beneficiary, and will deprive the government of a tax to which it is justly entitled and enable the beneficiary to escape a tax which she should have paid.
It is said that as the revenue laws treat the trustee and the beneficiary as distinct tax-paying entities, a court of equity must shut its eyes to the fact that in the realm of reality it was the beneficiary's money which paid the tax and it is her money which the petitioners ask the government to return. Formerly, trustee and cestui que trust were likewise distinct in the eyes of the law, as they are today for many purposes. But whenever the trustee brings suit in a court which is free to consider equitable rights and duties, his right to maintain the suit may be enlarged or diminished by reference to the fact that the suit, though maintained in the name of the trustee alone, is for the benefit and in the equitable interest of the cestui.
He can sue to set aside his own voluntary conveyance and impeach it as a breach of trust known to the transferee, because the action, brought to recover property for the trust estate, will inure to the advantage of the innocent beneficiary. Wetmore v. Porter, 92 N. Y. 76; Zimmerman v. Kinkle, 108 N. Y. 282, 15 N. E. 407; Atwood v. Lester, 20 R. I. 660, 665, particularly at 669; 40 Atl. 866, 868, 870; Franco v. Franco, 3 Ves. Jr. 75; American Law Institute, Restatement of the Law of Trusts, § 294. His suit to recover a debt due him as trustee, and payable by him over to the cestui, is subject to the equitable defense that the cestui has discharged the claim, McBride v. Wright, 46 Mich. 265 (Cooley, J.); 9 N. W. 275; Smith v. Brown, 5 Rich. Eq. (S. C.) 291; American Law Institute, Restatement of the Law of Trusts, § 328. That the cestui owes a like amount can be shown by way of equitable plea in set-off, Campbell v. Hamilton, Fed. Cas. No. 2,359; Waddle v. Harbeck, 33 Ind. 231, 234; Ward v. Martin, 3 T. B. Mon. (19 Ky.) 18; Driggs v. Rockwell, 11 Wend. (N. Y.) 504, 508; Wolf v. Beales, 6 Serg. & R. (Pa.) 242, 243; Agra & Masterman's Bank v. Leighton, L. R. 2 Ex. 56, 65; American Law Institute, Restatement of the Law of Trusts, § 329. In an action in general assumpsit, this defense may be shown under the plea of non-assumpsit, compare Winchester v. Hackley, supra.
In such cases equity does not countenance the idle ceremony of allowing recovery by the trustee only to compel him to account to the beneficiary who would then have to pay the proceeds to the original defendant. To avoid this circuity of action a court of equity takes cognizance of the identity in interest of trustee and cestui que trust. Likewise here, the fact that the petitioners and their beneficiary must be regarded as distinct legal entities for purposes of the assessment and collection of taxes does not deprive the court of its equity powers or alter the equitable principles which govern the type of action which petitioners have chosen for the assertion of their claim.
Equitable conceptions of justice compel the conclusion that the retention of the tax money would not result in any unjust enrichment of the government. All agree that a tax on the income should be paid, and that if the trustees are permitted to recover no one will pay it. It is in the public interest that no one should be permitted to avoid his just share of the tax burden except by positive command of law, which is lacking here. No injustice is done to the trustees or the beneficiary by withholding from the trustees money which in equity is the beneficiary's, and which the government received in payment of a tax which was hers to pay. A single error on the part of the taxing authorities, excusable in view of persistent judicial declarations, has caused both the underassessmeht of one taxpayer and the overassessment of the other. But the error has not increased the tax burden of either, for whether the tax is paid by one or the other, its source is the fund which should pay the tax, and only the equitable owner of the fund is ultimately burdened. Cf. United States Paper Assn. v. Bowers, 80 F. (2d) 82. Since in equity the one taxpayer represents and acts for the other, it is not for either to complain that the government has taken from one with its right hand, when it has, because of the same error, given to the other with its left.
Petitioners contend that recovery is precluded by § 275 (a) of the Revenue Act of 1928, which bars a "proceeding in court . for the collection" of a tax after the prescribed period, and by § 607, 609, which are said to prohibit "credit of an overpayment against a barred deficiency." Section 607 provides that any tax assessed or paid after the expiration of the period of limitation shall be considered an overpayment, and § 609 declares that a credit against a liability, in respect of any taxable year, shall be void "if any payment in respect of such liability would be considered an overpayment under section 607."
These provisions limit the collection of a tax, and prevent the retention of one paid after it is barred by the statute. They preclude, in a suit by the taxpayer against the collector or the government, reliance on a claim against the taxpayer, barred by statute, as a set-off, or counterclaim. But the demand made upon the trustees was not barred by limitation and it would be an unreasonable construction of the statute, not called for by its words, to hold that it is intended to deprive the government of defenses based on special equities establishing its right to withhold a refund from the demanding taxpayer. The statute does not override a defense based op the estoppel of the taxpayer. R. H. Stearns Co. v. United States, 291 U. S. 54, 61, 62. The statutory bar to the right of action for the collection of the tax does not prevent reliance upon a defense which is not a set-off or a counterclaim, but is an equitable reason, growing out of the circumstances of the erroneous payment, why petitioners ought not to recover.
Here the defense is not a counter demand on petitioners, but a denial of their equitable right to undo a payment which, though effected by an erroneous procedure, has resulted in no unjust enrichment to the government, and in no injury to petitioners or their beneficiary. The government, by retaining the tax paid by the trustees, is not reviving a stale claim. Its defense, which inheres in the cause of action, is comparable to an equitable recoupment or diminution of petitioners' right to recover. "Such a defense is never barred by the statute of limitations so long as the main action itself is timely." Bull v. United States, 295 U. S. 247, 262; Williams v. Neely, 134 Fed. 1, 13. Compare United States v. Macdaniel, 7 Pet. 1, 16, 17; United States v. Ringgold, 8 Pet. 150, 163, 164, where equitable recoupment against a claim by the government was allowed notwithstanding the immunity of the government from suit.
Affirmed.
Mr. Justice Roberts is of the opinion that the judgment should be reversed.
It has been held that in such a suit equity will not permit the grantee to set up the statute of limitations ordinarily applicable to a suit by the trustee if the trustee can show that the beneficiary, because of ignorance of the breach of trust or because of disability, would not have been barred by laches had he brought suit directly. Bridgman v. Gill, 24 Beav. 302; Duckett v. Mechanics Bank, 86 Md. 400, 411; 38 Atl. 983.
," . . admitting that the statute applies strictly to matters of set-off and counterclaim . . . still, as is well known, it does not affect the merits of the controversy." Aultman & Taylor Co. v. Meade, 121 Ky. 241, 247; 89 S. W. 137. Accord: Hart v. Church, 126 Cal. 471, 479; 58 Pac. 910; Wilhite v. Hamrick, 92 Ind. 594, 599; Butler v. Carpenter, 163 Mo. 597, 604; 63 S. W. 823; Evans v. Yongue, 8 Rich. Law (S. C.) 113; State v. Tanner, 45 Wash. 348; 88 Pac. 321.