We characterize the optimal mortgage contract in a continuous time setting with stochastic growth in house price and income, costly foreclosure, and a risky borrower who requires incentives to repay his debt. We show that many features of subprime loans can be consistent with properties of the...