Yup.
Amazon basically gets what amounts to a bulk-purchase discount, and Amazon spent about US$5 billion on shipping in 2015, so I imagine they get some really nice discounts. Also, they charge the customer significantly less than shipping actually costs.