They have to deal with less sales and or storing excess inventory.
Let's say you have some bruised bananas. You either have to keep them on the shelf till they rot (less space for sellable product) or donate them and then people won't buy as many bananas, so you need to raise the price.
Supermarkets and stores throwing away edible food is pure waste and fundamentally immoral when people are going hungry.
People eating donated bananas are not buying bananas if there are none available for free. They are just not eating bananas.