delivered the opinion of the court.
In order to arrive at the answer which should be given to the question certified upon this record, the objects first to be sought for are the intention and meaning of Congress in the enactment of the 2d section of the act of March 3d,Y839, under which the question sent here has been raised. The positive language of the statute, it is true, must control every other. rule of interpretation, yet even this may be better understood by recurrence to the known public practice as to matters in pan materia, and by the rules of law as previously expounded by the courts, and as applied to and as having influenced that practice. The law as laid dowR 'hy this court with *240respect to collectors of the revenue, in the case of Elliott v. Swartwout, 10 Peters, 137, and again incidentally in the case of Bend v. Hoyt, 13 Peters, 263, is precisely that which is applicable to agents in private transactions between mail and .man, viz.: that a voluntary payment to an agent without notice of objection will not subject the agent who shall have paid over to his principal'; but that payment with notice, or--with a protest against the legality of the demand, may create a liability on the part of. the agent who liall pay over to his principal in despite of such notice or protest. Such was the law as announced from this court, and Congress must be presumed to have been cognisant of its existence; arid.as the peculiar power ordained by the Constitution to prescribe rules of right and of action for all officers, as well as others falling Within the legitimate scope of federal legislation, they, must be supposed to have been, equally cognisant of the effects and tendencies of this court’s decisions upon the collection of the public- revenue.- With this -knowledge necessarily presumed-for them, Congress enact the 2d‘section of the act of -1839. It should' not be overlooked, for it is very material in seeking for the. views Of Congress in this enactment, that' the court, in the case off Elliott v. Swartwout, in its reasoning upon the .seeond point submitted to them, say, that the claimant by giving notice to’the'collector would “put him on his-guard,” by requiring him not to pay .over- the monéy. They farther- say, .that the collector would, by the same means, be placed in a situation to claim an indemnity. The precise .mode in which this protection qf the collector was to be accomplished, or his.indemnity secured, it is true, the court hrive not explicitly declared; but it is’ thought to be no forced construction of then: language to explain it as sanctioning a right of ■ retainer in the collector of the funds received by him for the government' ; for what shield so. effectual could he interpose between him- . self and the cost and-hazards of frequent litigation i Indeed, this would'appear, according to the opinion of the court, that very pro-' tection- which justice and necessity would equally warrant.' In practice, this retainer has, with or without warrant, been resorted to.
And now let Us look to .the language of -the act of 1839, chap. 82, § 2. “ That from and after the prissage of this act, all money ■ paid to any eollector .of jhe customs, or to any person acting as^such, for unascertained duties, .or for duties paid under protest against the ■rate or amount df, duties charged, shall be placed to the credit of the treasurer of the.United States; kept and disposed of as all other" money-paid for duties is required-by law, or by regulation of the Treasury Department, to be placed to the credit of the treasurer, kept - and disposed of; and it shall not be held-by said collector of person acting as such, to .await ary- ascertainment of duties,-or-the result of any litigation in relation to thé fate or amount, of duty legally ■ chargeable and collectable in any case where money is so paid: but ’ whenever it shall be shown to the satisfaction of die secretary of the *241Treasury, that in any case of unascertained duties, or duties paid • under protest, more money has been paid to. the collector, or to the person acting as. such, than the lawrequires should have been paid, it shall be his duty to draw his warrant upon the treasurer in favour of the person or persons entitled to the over-payment, directing the said treasurer to refund-the same out of any money in the Treasury not. otherwise appropriated.” What is'the plain and obvious import of this pro ion, taking it independently and as ¿ whole ? It is that all moneys thereafter paid to any collector for unascertained duties, or duties paid under protest, (i. e. with notice of objection by the payer,) shall, notwithstanding such notice, he placed - to the credit of; the treasurer, kept and disposed of as all other money paid for duties is required by law to-be kept and disposed of-; that is, 'they shall be paid over by the collector, received by the treasurer, and disbursed by him in conformity with appropriations by law, precisely as if. no notice or protest had been given or made; and shall not be retained by the collector (and consequently not withdrawn' from the uses of the government) to await any ascertainment of duties, or the.result of any litigation relative to the rate or amount of duties, in any case'in which money is so paid.
This section, of the act of Congress, considered independently and as apart -from the facts .and circumstances' which are known to have preceded it, and may fairly he supposed to have induced its enactment, must -be understood as leaving with the collector no lien upon, or discretion overj the sums received by him on account of the duties described therein; .but as converting him into the mere bearer of those sums to the Treasury of the United States, through the presiding officer of which department they were to be disposed of in conformity, with- the law. Looking then to the immediate operation of this section upon the conclusions either, directly announced or as implied in the decision of Elliott v. Swartwout, how are those conclusions affected by it ? They must be influenced by consequences like the following: That, whereas by the decision above mentioned it is assumed that by-notice to the collector, or by protest against payment, a personal liability for the duties actually paid, attaches upon, and that'for his protection a.correspondent right of retainer is created on his part; it is thereby made -known (i. e. by the statute) that under no circumstances in future should the revenué be retained in the hands of the collector: that he should in ho instance be regarded by those making payments to him as having a lien upon it, because he is announced to be the mere instrument or vehicle to convey the duties paid into his hands into the Treasury: that it is ffie secretary of the . Treasury aloné in whom the rights of the government and of .the claimant are to be tested: and that whosoever shall pay to a collector any money for duties, must do' so ' subject to the consequences herein, declared. Such, from the 3d day of was the law of the United States; it *242operated as notice to every one; it applied, of course, to every citizen as well as to officers concerned in the regulations of the revenue; and as it removed the implications on which the decision of Elliott v. Swartwout materially rested, that case cannot correctly control a question arising under a different state of the law,'and under a c.ondition of the partiés- also essentially different.
It will not be irrelevant here to advert to other obvious and cogent reasons-by which Congress may have been, impelled to the enactment in question; reasons which, it is thought, will aid in furnishing a solution of their object." Uniformity of imports and ex-. cises is required by the Constitution., Regularity and certainty in the payment'of the revenue must be admitted By eveiy one as of primary importance: they maybe said almost to constitute the .basis .of good faith in the transactions of the government; to be essential to" its practical-existence'. Within the extended limits of this country are numerous collection-districts; many officers must be intrusted 'with thé collection of the revenue, and persons much more numerous, with every variety of interest and purpose, are- daily-required to make payments at the ports of entry. To permit the receipts at the customs to. depend on constructions as numerous as are the agents employed, as various as might be the designs of those who are interested; or to require that those receipts shall await a settlement of every dispute or objection that might spring from so many conflicting views, would be.greatly to disturb, if not to prevent-,'the uniformity prescribed by the Constitution, and-by the same means to withhold from the government the means of fulfilling its important engagements. In .the -view of mischiefs so serious, and with the intention of preventing or remedying them, nothing would seem more probable or more reasonable, we might add more necessary, thaxi. that the government should endeavour to devise a plan by which, as far as practicable, to retain its fiscal operations within its .own control, thereby.insuring that uniformity in practice, enjoined by the theory of the Constitution, and that punctuality which is - indispensable to the benefit of all. Such a-plan has Congress devised in the act in question. We have no doubts of the objects or the irpport of that act; we cannot doubt that it constitutes -the secretary of the Treasury the -source whence instructions are to flow: - that it controls both the position apcl the conduct of collectors of the revenue: that it has denied to them every right or authority to retain any portion of the revenue for. purposes of contestation or indemnity; has ordered and declared those collectors to be the mere organs of receipt and transfer, - and has made the head of the Treasury Department the tribunal for the examination of claims for duties said to have been improperly paid.
It has been urged that the clause of the act of 1839 declaring that the money received shall not be held by. any collector to await any ascertainment of duties, or the result of any litigation in relation *243to the rate or amount of duties legally chargeable and collectable in any case where money is so paid,; shows that Congress did not . mean to deprive the party of his action of .assumpsit against the collector: that litigation of that description was still contemplated, and that- the only objeet of the law was .to place the money in dispute in the possession of the treasurer, to await a decision; instead: of leaving it iu the hands of the collector. The court cannot assent to this.,construction. It will be remembered that the two principal cases in which collectors' have' claimed the right to retain, have been those of unascertained , duties, and-of suits, brought, or threat- : ened to be brought, for the .'recovery of duties paid under protest: It is matter of history that the alleged right to retain .on these two accounts, had led .to great abuses, and to much loss to thepublic;. . and "it is to these two subjects, therefore, that the act of Congress particularly addresses itself. ' It begins by declaring that all money received on these accounts shall be.paid into the Treasury; and then, in order, to show that the collector is not the person with whom any claims-for this money are to be' adjusted, or who is to be held responsible for. it, the act proceeds to declare that the money shall not remain "in his hands even if the protest is followed by á süit: that, notwithstanding suit may be brought against him, he, shall still pay the money into the Treasury, and that the controversy shall'be adjusted with the secretary. Congress supposed,- probably, that a party might choose to sue the collector,.as Has been done in this -instance; but-it does not by ‘any means-follow, that it was intended to. make him. liable in the suit,'or to give the party the right of recovery against him. The words used go to show, that neither a protest which is mentioned in the first, part of the section, nor a suit which is mentioned in the clause of which we-are speaking, shall be a pretext or excuse for retaining the moneyl Suppose the words in relation to a litigation had been omitted, and the law. had said, that, the collector should not retain the money for any ascertainment of duties, but that the secretary of. the Treasury in that case, as well as in the case of duties paid under protest, should adjust the claim and pay what was really .due. The omission supposed would have strongly implied that, if there was.litigation, he might retain, and it might be said with milch show of reason,-that by forbidding , him -to retain' for unascertained duties, but not forbidding him to retain in case,of litigation for.duties paid under protest, implied that he could not retain for the former but .might for the latter. We hold it not a logical mode of reasoning where the omission of words would evidently lead to a' particular conclusion, to argue that their insertion can -do the same thing.Besides, the' litigation spoken of, and which is said to lead to this result, is a litigation for duties paid under protest, and not for over-payments of unascertained duties. If these words were intended to'sanction suits against collectors for the former, why are litigations *244for the latter not also countenanced ? Independently of this statute, the collector might have been sued for ovér-payrnents on unascer-tained duties as well - as for duties paid under- protest. And it can hardly be reconciled with reason or consistency that Congress' designed to preserve the right of suit in the one case, and to deny it in the other. Yet if these words have the force contended for by the defendant in error, they give the right of action against the collector for duties paid under protest only, leaving-the party who has overpaid unascertained and estimated duties, no remedy but- that of resorting to the secretary of the Treasury. ' It would be difficult to assign any good reason for such a diversity; we think none such was intended, that none such in reality exists, that the law intends merely- to decláre that if the protest is followed by a suit, the duties in that case as well-as in the other, shall be paid -into the Treasury and shall not remain, in the hands of the collector,to abide the result of the-suit. The conclusion to which wé have come upon -this statute'is greatly strengthened by the act of Congress of May 31st, 1844, chap. 31, which,- in suits brought by the United States for the enforcement of the -revenue laws, or for the collection of. duties due or .alleged to be due on merchandise imported, authorizes a writ of error from this court to the Circuit Courts without regard to the sum in controversy. The object of this law undoubtedly was, to obtain uniformity of decision in regard to the duties imposed. Prior to the act of 1839 there were often differences' of opinion in the circuits in the construction of the laws, and • in instances too in which the amount in controversy was too: small to.enable either party to bring them here forrevisal by writ of error. It can hardly then -be imagined that when Congress -was taking measures expressly to secure uniformity of decision and practice in relation to.the amount of duties imposed by law,- they would have confined the writ of error to cases brought by the United States, when they were of small amount, and refused it in suits against collectors in similar controversies-, if they supposed that such suits could still be maintained.. -Indeed it has heretofore been in this latter form that the amount of duties' claimed has been far more frequently contested, than by suits brought by the United State.s. . And if this form of trying the question had not been intended -to be taken away by the act of 1839, there could have been no reason for excluding it from the act of 1844.. For the purposes obviously designed by this law, it would have been much more important to the public to have allowed the writ of error in suits against collectors, than in suits instituted by the United States, supposing suits of the former description to be still maintainable ; and the -omission of such a remedy strongly implies that the legislature. supposed such suits could •be no longer maintained.
• It is contended, however, that the language and the purposes fif Congress, if really what we hold them tó be declared in the statute *245of 1839, cannot be sustained, because they would be repugnant to the Constitution, inasmuch as they would debar the citizen of his. right to resort to the courts of justice. The supremacy of the Constitution. over all officers and authorities, both of the federal and state governments, and the. sanctity of the rights guarantied by it, none will question. These are coneessa on-all sides. The objection above referred to admits of the most satisfactory refutation. This may be found in the following positions, familiar in this and in most other governments, viz.: that the- government, as a general rule, claims an exemption from being sued in its own courts. That although, as being charged with the administration of the. laws, it will resort to those courts as means of securing this great end, it will not permit-itself .to be impleaded therein, save in instantes forming conceded and express exceptions. Secondly,' in the. doctrine so often ruled in this court, that the judicial' power of the United States, although it has its origin in the Constitution, is (except in-enumerated instances, applicable, exclusively to this court) dependent for its distribution and organization, and for the modes of its exercise, entirely upon the action of Congress, who possess the sole power of creating ' the tribunals (inferior to the Supreme Court) for the exercise of the judicial power, and of investing them with jurisdiction either.limited, concurrent, or exclusive, and- of withholding jurisdiction from them in the exact degrees and character which to Congress may seem proper for the public good. To deny this position-would be to elevate the judicial over the legislative branch of the government, and to give to the former powers limited by its own discretion merely. It follows, then, that the courts created by statute must-look to the statute as the warrant for their authority; certainly they cannot go beyond the statute, and assert an authority with which they may not be invested by it, or which may bé clearly denied to them. This argument is in nowise impaired by admitting that the judicial power shall extend to all cases arising under the Constitution.and laws of the" United States. Perfectly consistent with such an admission is the truth, that the organization of the judicial power, the .definition- and distribution of the subjects of jurisdiction in the federal tribunals, arid the modes of their action and authority, have been, arid of right must be, the work of the legislature. The existence of the Judicial-Act itself, with its several supplements,, furnishes proof urianswerable'on this point. The courts .of the United States are all limited in their nature and constitution, and have not the powers inherent iri courts- existing by prescription or by the common law.
■ In devising a systeiri for imposing and collecting the public revenue, it was competent for' Congress to designate the officer of the government in Whom the rights of that government should be "represented in any conflict which might arise, and to prescribe the manner of trial. It is not imagined, that, by so doing Corigress is justly chargeable with usurpation, or that the citizen is thereby deprived *246o£hi& rights. There is nothing arbitrary in such arrangements; .they ■ aré general in their character; are the result of principles inherent in the government; are defined and promulgated as the public law. A more Striking example of the powers exerted by the government, in relation to its-fiscal concerns, than is seen in the. act of 1839, is the power of distress and sale, authorized by the act of Congress of May 15th, 1820, (3 Story, 1791,) upon adjustments of accounts by the first-comptroller of the Treasury. This very strong and summary proceeding has now been in practice for nearly a quarter of a century, without its regularity haying been questioned, so far as is known to the court. The courts of. the United States can take cognisance only of subjects .assigned to them expressly or by necessary implication ; ci fortiori, they can taire no cognisance of matters that by hw are either denied to them or expressly referred ad aliud examen.
But whilst ■ it has been deemed proper, in examining the question referred by the Circuit Court, to clear it of embarrassments with which, from its supposed connection with the Constitution, it is thought to be environed, this'court feel satisfied that such embarrassments exist in imagination only and not in reality: that the case and the question now before them present no interference with the Constitution in any one of its provisions, and may be, and should be disposed of upon the plainest principles of common right. In testing thése propositions it is. proper to recur to the case of Elliott ana Swartwout, and again to bring; to view the grounds on which that case was ruled. It was, unquestionably,‘decided upon principles which maybe admitted in ordinary cases of agency, which expressly recognise the right, nay, the duty-of the agent to retain, ahd make his omission so .to retain' an ingredient in the gravamen or breach of duty, whence his liability, and his promise are implied by the law. The language of the court, 10 Peters, 154, is (his: “ There can be no hardship in requiring the party to give notice to the collector that he considers the - duty claimed illegal, and put him on his guard by . requiring him not to pay over the money. The collector.would then be placed in a situation to claim an indemnity from the government. But . .if the party is entirely silent, and nq intimation is given of an intention to seek repayment of the money, there can bé no ground úpon’which. the collector can retain the money, or call upon the government to -indemnify him agaipst a suit.” Here then the, right and the duty of retainer are sanctioned .in the officer; wiíhóqt them the notice spoken of would he-nugatory — a--vain act,. Which the law never requires.. And this right and. this duty in the officer,.and this injunction of notice to him, must all be understood and áre propounded in this decision as principles or precepts of the law, with the knowledge of which each'of the parties must stand affected.
The action of assumpsit1 for money had and received,-it is said by Ld. Mansfield, Burr. 1012, Moses v. Macfarlen, will lie in general whenever the defendant has received money which is the property *247of. the plaintiff, and which the defendant is obliged by the ties of natural justice and equity to refund. And by Buller, Justice, in Stratton v. Rastall, 2 T. R. 370, "that this action has been of late years extended pn the principle of its béing considered like a bill in equity. And, therefore, in order to recover money in this form of action the parly must show that he has equity and conscience on his side, and could recover in a court of equity.’.’ These are.the general grounds of the action .as given from high authority. There must be room for implication as between the parties to the action, and the recovery must be eás equo et bom, Or it can never be; If the action is to depend on the principles laid down by these judges, and especially by Buller, a case of hardship merely could scarcely be founded upon them j much less could one of injustice or oppression, nor even one which arose- from irregularity or jndiscretion in the plaintiff’s own conduct. So far as the liability of agents in this form of action appears to have been considered, the general rule certainly is, that the action should be brought against the principal and not against a known agent, who is discharged from liability by a bond fide payment, over to his principal, unless anterior to making payment over he shall have had notice from the plaintiff of his right and qf his intention to claim the money. The absence of notice will be an exculpation of the agent in every instance. And with regard to the effect of the notice in fixing liability upon the agent, that effect is dependent on the known powers of the agent ana the character of his agency. If, for. instance, the agent was known to be a mere carrier or vehicle to transfer to his employer the amount received, payment to the agent with .such- knowledge, although- accompanied with a denial of the justice of the demand, would seem to exclude every idea of an agreement express or implied on the part of the agent to refund; and cduld furnish no ground, for this action against the agent who should pay over the fund received to his principal. This doctrine is' believed to be sanctioned by the cases of Greenaway v. Hurd, 4 T. R. 553, of Coles v. Wright, 4 Taunt. 198, and of Tope v. Hockin, 7 Barn. & Cres. 101. ’Tis true that the, case in Taunt, aha that from Barn. & Cres. were not instances of payment under protest; but the casé from 4 T. R. has this common feature with that before us, that it was an action against an excise officer’for duties said to have been illegally collected, in which thé plaintiff denied the legality of the demand, though he subsequently paid it. Biit all three of these cases concur in condemning the harshness of a rule which would subject an agent, who is a mere channel of conveyance or delivery of the amount which might pass through his hands. Neither of thése cases was affected by a positive statutory mandate requiring the agent to make payment over to his principal.
Another principle held, to be fundamental, to this action is this: that there must exist a privity between the plaintiff and defendant; something on which an obligation, an engagement, a promise from *248the latter to the former can be implied; for if such implication be excluded from the relation between the parties by positive law, or by inevitable legal intendment, every foundation for the promise and of 1he action upon it is destroyed ; for none can be presumed or permitted to promise what either law or reason does not warrant or may actually forbid. Thus, W'here bankers received- bills from their foreign correspondents, with directions to pay the amount to the-plaintiff, but on being applied to by him refused to do so, although they afterwards received the amount of these bills; it was held, that an action for money had and received wrould not lie to recover it from them, there being no privity between them and the plaintiff. LordEilenborough observed, the defendants might hold for the benefit of the remitter, until by some engagement entered into by themselves with the persons who were the objects of the remittance, they had precluded themselves from so doing; but here, so far from there being such-an engagement, they repudiated it altogether. Williams v. Everett, 14 East, 582. Again, where J., an attorney, who was accustomed to;receive dues for the plaintiff, went from home, leaving B., his clerk, at the office; B., in the absence of his master, received money on account of the above dues "for the client, which he was authorized to- do, and gave a receipt “B., for Mr. J.” J. was in bad circumstances when he left home, and never- returned. B. afterwards re-fused to pay the money to the client, and on an action for money had and received against him, it wms held not to lie; for the defendant' received the money as the agent of his master, and was accountable to him for it; the master, on the other hand, being answerable to the client for the money received by the clerk, there was no privity of contract betwreen the present plaintiff and the defendant: Stevens v. Badcock, 3 Barn. & Adolph. 354. So in the case of Sims et al. v. Brittain et al., 4 Barn. & Adolph. 375. A., B., and. others, were part-owners of a ship in the service of the East.India Company; B. was managing owner, and employed C. as his-agent,- and C. kept a separate account on his books withB. as such managing owner. In order to obtain payment of a sum of money from the East India Company on account of the ship, it was necessary that the receipt should be signed by one or more of the owners besides the managing owner; and upon a receipt being signed by B. and by another of the owners, C. received ¿62000 on account of the ship, and placed it to the credit of B. in his~books as managing )wner; the part owners having brought money had and received to ecover the balance of that account, held, that C. had received the uoney as the agent of B., and was accountable to him for it; and hat there was no privity between the other part-owners and C., and onsequently, that the action was not maintainable. To the same fféct are the cases of Rogers v. Kelly, 2 Camp. 123, and Edden v. tead, 3 Camp. 339,, and Wedlake v. Husley, 1 Crompton & Jarvis, 3. If indeed the defendant has consented (where he can properly. *249consent) to hold the money for the use of the plaintiff, he may be liable. And it is conceded, that his consent need not be express, but it must, if not so, rest upon fair and. natural implication Or legal intendment. Where such implication or intendment is excluded, forbidden by the position of the parties, by positive law, or by the character of the. transaction, consent or any obligation upon which .to imply it is éntirely removed.
We have thus stated, and .will here recapitulate, the principles on which the action for. money had and received may be maintainéd. They are these; 1st., Whenever the defendant has received money which is the property of the .plaintiff, and- which, the defendant is obliged, by the ties of natural justice and equity, to refund.. 2dly. In the case of an agent, where- such agent is not notoriously the mere carrier or instrument for transferring the fund, but has the power of retaining, and before he has paid over has received notice of the plaintiff’s claim, and a' warning not to part with the fund. 3dly. Where there exists a privity between the plaintiff and the defendant. Let the case before us be brought to thp test of these rules. 'The 2d section of the act of. Congress declares, first, that from its passage, all money paid to any collector of the customs for unascertained duties, or duties paid under protest against the rate or amount of duties charged, shall be placedlo the credit of' the treasurer, to be kept and applied as all other money paid for, duties required by law. Secondly, that they shall not be held by the collector to await any ascertainment of duties, or the result of ány litigation concerning the rate or amount of duty legally chargeable or collectable. And thirdly, that in all cases of dispute as to the rate of duties, application shall be made to the secretary of the Treasury, who shall direct the repayment' of any money improperly charged: This section, as a part of the public láw, must be taken as notice to all revenue officers, and to all importers and others dealing with those officers in the line of their duty. There is nothing obscure, or equivocal in this law; it declares to every one subject to the payment of duties, the disposition wnich shall be made of .all payments in future to collectors; tells them those officers shall have no discretion over money received- by them, and especially, that they shall never retain it to await the result of any contest concerning the right to it; and that qtwad ihis money, the statute has converted those officers into mere instruments for its transfer to'the Treasury. With full knowledge thus imparted by the law, can it be correctly understood that the party making payment can, ex equo et bono, recover against the officer for acting in literal conformity with the law, converting thereby the performance of his duty into an offence; or that upon principles of equity and good conscience, an obligation and a promise to refund shall be implied against the express mandate.of the law? Such a presumption appears to us to be subversive of every rule of right.. The more correct.inference seems to be, that payment under such circumstances *250must, ex equo et bono, nay, ex necessitate, and in despite of objection ' made at the time, be taken as being made in conformity with the mandate of the law and the duty of the officer, which exclude not only any • implied promise of repayment hy the'officer, but would render void an express’promise by him, founded upon á violation both of the law and of his duty. The claimant had his option to refuse payment; the detention óf the goods for the adjustment of duties, being an incident of probable occurrence, to avoid this it could not be permitted to effect the abrogation of a public law, ora system of public policy essentially connected with the general action of the government. The claimant, moreover, was not without other modes of redress, had he chosen to adopt them. He might have assertedhis right to the possession of the goods, or his exemption from the duties demanded,' either by replevin, or in an action of detinue, or perhaps by an action of trover, upon his tendering the'amount of duties admitted by him to be legally due. The legitimate inquiry before this court is not whether all right of action has been taken away from the party, and the court responds to' no such inquiry. The questionpresented for ■ decision, and-the only question decided, is'whether, under the notice given by the statute.of 1839, payments made in despite of that notice, though with a protest against their supposed .illegality, can constitute a ground for that implied' obligation to refund, and for that promise inferred by the law from such obligation, which are inseparable from, and indeed are the only foundation of, a right of recovery in this particular form of action. And here is presented the answer to the assertion,, that by the act of 1839, or by the construction given to it by this court, the party is debarred afi access to the courts of justice, and left entirely at the mercy'of an executive officer. Neither have Congress nor this court furnished the slightest ground for the above assertion.
But the objection to a recovery in. this action may be farther extended, upon. grounds which to the court appear to be insuperable,. We all know that this action for money had and received is founded upon what the law terms an implied promise to páy what-in good' conscience the defendant is bound to pay to the plaintiff. It being in such case the duty of the defendant to pay, the law imputes to him a promise to pay. This promise is always charged in the declaration, and must be so charged in order, to maintain the action. It was. upon this principle that the action for money had and received was sustained in the case of Elliott v. Swartwout. There money-had been taken by the collector for duties whieh.wéré not imposed. This money lawfully belonged to the plaintiff; it was the duty, therefore, of the collector to pay it back to him. The collector was not bound to pay. it fo .the treasurer, for the law. did hot command this disposition, of it. It did not belong to the United States, who had no right, therefore, to demand it of him, and copld not have recovered it against him, in a. suit, if he had paid" it back to the true *251owner. 'It being the duty of the collector to return what he had unlawfully taken, the law implied on his part a promise to do so; and on this implied promise, arising or inferred from a duty imposed upon him., the action was maintained. . The protest" and notice were to him of no farther importance than to warn him'to hold over, and to take aw.ay an excuse he might otherwise have had'from payment to his principal. It was his duty, as the law then stood, not to pay over, but to pay back to the party from whom he had collected ‘without-legal áuthorily, when warned that this party should look to him for reimbursement, and not to his principal. Butthe law never implies a promise to pay; unless.-duty creates the obligation to pay; .and more especially it never'implies a promise to do an act contrary to duty or contrary to law.- Now, under the statute of 1839, if the collector receives money, though for duties'not due, it is nevertheless made his .duty to pay it into the Treasury, to be repaid there, if the party claiming is found to be entitled to it. And the question here is, will the law imply a.promise .from, the collector to do that which is contrary to his official duty, contrary to the. command of a positive statute ? If it will not, then the action of assumpsit for money had and received will not lie in this case. .
Moreover, the law will never1 imply a promise where it would be unjust to the party to whom it would be imputed, and contrary to equity so to imply it.- -Suppose the collector should not, as directed. by law, pay the money into the Treasury, the United States might .undoubtedly maintain an action against him for money, had and received to their use. Because it being his duty toi do so, the law would imply a promise to pay it. Can the law at the same time imply a promise to pay it elsewhere or to another, and thus burden the collector with the double obligation of paying to the government, and also to one claiming in adversary interest ? If suits were. instituted against him by both parties, and were standing for trial at the same time, would both be . entitled to a recovery, and would the law imply promises to both, promises .to pay double the. amount received? We think not; and as the law in positive, terms directs payment to be made into the Treasury,, there can be no judicial implication contrary to law, nor that the collector will pay to another what the law directs him to pay to the-United. States; and no judicial implication which would- require him to be guilty, of an act of official misconduct, or a breach, of his duty to the public. If the law implies a promise to pay baek.to the party, then it must be the duty of - the collector tó. do so as soon as it is demanded. If the money may be recovered of him by suit, then he would be justified' -in-paying without'suit, yet if he does so pay, he not only violates a duty imposed by law, but may be compelled tó pay over again to the government, as for so much money had and received to its use. We think the law can never imply a .promise, which must be unjust and oppressive in its results to the party, or contrary to his duty as *252a public officer'; and there being no implied promise, therefore in this case the action for money had and received cannot be maintained. It is perfectly clear to the court that, under the act of 1839, the United.- States have, by express law, a right to demand the money from be-collector, and to recover.it in an action for money had and received, even if that officer had paid it over to the person from whom he had received it; and we say with confidence that.in the multitude of cases that háve been decided in relation to that action, there is not one in which it has been held that money could be recovered from a defendant when his voluntary- payment of it would leave him still liable to an action for the same money by another.''
We deem it unnecessary to examine farther the grounds stated in the second and third heads of inquiry, as forming the foundation of the action for money had and received; or to bring to a particular comparison with those grounds the law and the facts of this case, as presented upon the record. The illustrations given under the first head embráce all that is'important under the remaining divisions, with respect to the nature of the demand and the position of the parties. Those illustrations establish, in the view of the court, that, so far is the defendant from being obliged, by the ties-of natural equity and justice, to refund to the plaintiff the money received for duties, that, on the contrary, under that notice of the law which all must be presumed to possess, the payment must be understood as having been made with knowledge of ihe parties that the right of retaining or of refunding the money did not exist in the defendant; that the money by law must pass from' him immediately upon its receipt; that payment to him was in legal effect payment into the Treasury; that -notice to him was,. under such circumstances, of no effect to bind' him to refund;. that as the collector, since the statute, had power neither to retain nor refund, there could, as between him and •the plaintiff, arise no privity nor implication, on which to found the promise raised by the law, only where an obligation to undertake or promise exists; and that, therefore, the action for money had and received could not, in this case, be maintained, but was barred by the' act of Congress of 1839.