Can you get a 40-year mortgage?

As home affordability shrinks, some buyers are turning to 40-year mortgages. But while these loans have their perks, they're also pricey — and risky.