If the food is no good (out-of-date), you can't even give it to anyone, including homeless by law. Food prices for basic goods (wheat, apples, rice, beans, etc) are incredible low, money is not the issue here.
Actually, what a lot of people don't realize there's actually a law that protects retailers from liability if someone gets sick.
As long as the food isn't exhibiting signs of spoilage, you're free from liability.
Dating isn't required by law except in the case of infant formula. Dating is done by manufacturers for themselves and stores.
Money a lot of times is an issue. People can have lots of other bills, that leave them with very little for food. I know people who have experienced that. Feeding a family can easily be expensive.