On 19 May 1760, Lord Mansfield (left) delivered judgment in the famous case of Moses v Macferlan (1760) 2 Burr 1005, 97 ER 676, [1558-1774] All ER Rep 581, [1760] EngR 713 (19 May 1760) (warning: pdf; an unofficial html is here).
Much of the modern law of restitution has been constructed upon the foundations which he laid down:
If the defendant be under an obligation, from the ties of natural justice; to refund; the law implies a debt, and gives this action, founded in the equity of the plaintiff’s case, as it were upon a contract (“quasi ex contractu,” as the Roman law expresses it).
This species of assumpsit, (“for money had and received to the plaintiffs use,”) lies in numberless instances, for money the defendant has received from a third person; which he claims title to, in opposition to the plaintiff’s right; and which he had, by law, authority to receive from such third person. …
This kind of equitable action, to recover back money, which ought not in justice to be kept, is very beneficial, and therefore much encouraged. It lies only for money which, ex aequo et bono, the defendant ought to refund: it does not lie for money paid by the plaintiff, which is claimed of him as payable in point of honor and honesty, although it could not have been recovered from him by any course of law; as in payment of a debt barred by the Statute of Limitations, or contracted during his infancy, or to the extent of principal and legal interest upon an usurious contract, or, for money fairly lost at play; because in all these cases, the defendant may retain it with a safe conscience, though by positive law be was barred from recovering.
…