Special shoes

Is it really necessary to have special shoes for each sport? For example walking shoes, aerobic shoes, and basketball shoes...do they make a difference in performance or is it just a marketing ploy to make us buy more?