When two parties come to an agreement, whether it be for services, goods or something else, like an investment, a contract is not always formed.  In such a situation, where no contract is formally created, but one party benefits from the conduct or actions of the other, in some cases, the equitable doctrine of unjust enrichment can protect the party providing the benefit.  

Morris Pumps v. Centerline Piping, Inc., 273 Mich. App. 187 explains:

In order to sustain a claim of quantum meruit or unjust enrichment, a plaintiff must establish (1) the receipt of a benefit by the defendant from the plaintiff and (2) an inequity resulting to the plaintiff because of the retention of the benefit by the defendant. Barber v. SMH (US), Inc., 202 Mich. App. 366, 375 (1993).  In other words, the law will imply a contract to prevent unjust enrichment only if the defendant has been unjustly or inequitably enriched at the plaintiff’s expense.

However, there is an important exception to the equitable principle of unjust enrichment.  If a contract exists that covers the arrangement, courts will look to the contract itself to resolve the dispute.  In such a case, courts will not allow a claim of unjust enrichment.

Campbell v. Troy, 42 Mich. App. 534 (1972) makes the above point regarding the existing of an express contract abundantly clear.  

A contract will be implied only where no express contract exists. There cannot be an express and implied contract covering the same subject matter at the same time.  (citing Superior Ambulance Service v. Lincoln Park, 19 Mich App 655 (1969)).

But, keep in mind, it is not enough for a contract to just exist regarding the same subject matter that forms the basis for the unjust enrichment claim.  The express contract that covers the same subject matter must also be between the same parties.  

This distinction proved to be a key point in Morris Pumps:

Turning to the case at bar, we recognize that there existed express contracts between plaintiffs and Centerline, all of which concerned the subject matter at issue here. Thus, we agree with defendant that there were express contracts covering the same subject matter.  However, defendant was not a party to any of these express contracts. Therefore, the contracts did not exist between the same parties. Because there were no express contracts between the same parties on the same subject matter, defendant’s argument with respect to this issue must fail. The mere existence of the express contracts between plaintiffs and Centerline does not bar recovery from defendant in quantum meruit.  273 Mich. App. at 194-95.

Ultimately, if you have a contract dispute, or you believe you have provided a benefit to another that resulted in some sort of injustice, you should consult a qualified attorney to help you navigate the nuances of your issue—as the above cases show, the smallest distinction can make the biggest difference.