We present a model of long-duration collateralized debt with risk of default. Applied to the housing market, it can match the homeownership rate, the average foreclosure rate, and the lower tail of the distribution of home-equity ratios across homeowners prior to the recent crisis. We stress the role of favorable tax treatment of housing in matching these facts. We then use the model to account for the foreclosure crisis in terms of three shocks: overbuilding, financial frictions, and foreclosure delays. The financial friction shock accounts for much of the decline in house prices, while the foreclosure delays account for most of the rise in foreclosures. The scale of the foreclosure crisis might have been smaller if mortgage interest payme...