In the US you may exclude up to half a million dollars of gains from your taxable income if you owned and lived in a property for at least two years. Otherwise gains on the sale of real property are taxed as ordinary income.
Specifically, 250K for single filers, 500K for married couples. Also, if you're married by Dec 31st, the IRS counts that the same as being married all year in terms of filing status eligibility, so it may pay off to get hitched before you sell and divorce after ;-)
It's not harsh, it's acknowledging that windfall income is unearned. That half a million exemption (or half that for unmarried people) is in addition to deductions for all depreciation and expenses.