Yes, this is a social dilemma, and @Dr.Strangelove’s analysis is correct. A lot of the people in this thread seem to miss the whole point of what you’re saying, and so a lot of replies are just “but this is why it’s to my advantage to pick the freshest” - yes, we know, that’s baked into the premise.
If everyone acted in this manner, then we’re all worse off. That’s a social dilemma. Usually resources can support a number of selfish actors without collapsing or getting worse for everyone, but that doesn’t mean that those people aren’t being selfish.
No matter how you look at it, if everyone always picked the freshest option, it would lead to waste. You have a batch of 10 milks that expire in 14 days, and a batch of 10 that expire in 15 days. Everyone picks the ones that expire in 15 days, because it’s a little bit better for them. So there’s a restock, the next day, and those original milks are there, now expiring in 13 days, and a new batch, now expiring in 15 days. Everyone picks from the new batch. Eventually, those 10 milks will have to be thrown out, even though they would’ve been used had people decided not to maximize their own gain at the expensive of everyone else.
And saying “oh well the wholesaler eats that cost” is just a very weak rationalization. So what? Someone is eating that cost, whether it’s the store or the wholesaler, it’s like you’re just wishing it away by suggesting that it’s okay if it’s suffered by an entity one tier up. That cost eventually costs everyone, and more importantly, it’s waste. Some animal suffered to generate that milk. Water, land, food, gas, and human effort were spent to get that milk to market. Having it go to waste is an objectively bad thing.
And when you suggest that the grocery store should adapt by haivng less stock or some other solution, you’re essentially saying that “it’s their fault for creating an exploitable system, not me for exploiting it”, which is selfish rationaization. Sure, they could have a guy standing at every dated product handing out the one with the nearest expiration date - that would stop this exploitation, but it would also be a waste of human time. Same with smaller stock and more frequent restocking. Now human effort is being wasted to police you from selfishly exploiting a system. That makes you the bad guy, not them.
So, in the grand scheme of things, this is a relatively minor transgression. There are few enough exploiters that the resource will generally not suffer for it. The OP correctly identifies it as being a “minor selfish jerk.” But this absolutely is a social dilemma and exactly the same sort of mentality that leads to other, more important social dilemmas that cause real problems.