I think firstly, there is an assumption here that any profit has been made. Not always the case. However, I can say that these would be some of the reasons:
1) Agree on saving on brick and mortar costs. The cost of starting an online retail store is much less. However, if you're then factoring all your cost of acquisition costs, that might not always be the case.
2) Attracting new customers:
stores that are often new to the market and want to grow aggressively, sometimes need new discounts and deals to attract new customers since that lowers barrier to entry, the concern about purchasing based on cost, etc. That being said, the online shopping site is more than happy to do that, in order to attract a new customer that will hopefully, via other marketing means (loyalty, referral, love of the product) return again to shop.
With online retail, there is much more freedom because with discounting, you're banking on the fact that there will be volume. With larger volume sales coming in due to a higher amount of discounts, you'll see the bump in revenue that you'll be waiting for, and if you do your math right, you'll be able to recoup whatever losses ( or original margins you've not kept to) thanks to the large amount of traffic you've hopefully attracted thanks to this discount.
Every online store should or does set aside some money for discounting, so that it doesn't impact margin or profitability to a certain degree (again, this really depends on what the goal is for the online store (new customers, aggressive growth, re-igniting their old customer base, increasing referrals), but this is a pre-calculated amount set aside usually every month that can be used. Other stores who don't wish to discount can also use this amount to buy products for giveaways or other promos.