For average-sized homes, buying a home is usually a better deal than renting, a new study confirms.