The mortgage interest deduction serves to put prospective owner-occupants on an equal footing with prospective landlords (for which business loan interest is deductible against profits).
The capital gains exclusion I have less strong feelings about, but it amounts in large part to excluding being taxed on the effect of inflation.