Most loan agreements are carefully drafted documents designed to operate through carefully specified mechanisms. But when a contract fails for some reason, or stops applying, the borrower is likely to be required to repay the money that has been obtained through a restitutionary claim. What are the bases for such claims? And how do they relate to the intended contractual provisions?