I don't think it's about the profitability, at least for non-amazon stores, none have the volume to make it worth their while. But what they are going for is trying to get somewhere close to the wide selection that amazon has.
If you need something specialized like say, upholstery glue, Walmart may have 5-6 different options, one or two of which might be sold by Walmart themselves, if you are lucky. Which means likely long shipping times for all the others as they won't qualify for Walmart plus or whatever they call it.
If you search that on Amazon, you will find probably 30-40 different brands and types of upholstery glue available in all difference sizes, in a jug, in a spray bottle, bulk sized, etc. Most of which is available for Prime 1-2 day shipping and will show up next day.
Walmart and other retailers need to be working with some warehouse logistics companies that basically do what amazon FBA. Because as it is, most of the 3rd party listings on other retail sites are just drop shippers trying to arbitrage off Amazon or ebay products. If you buy from them, the seller will just purchase it from Amazon or ebay and have it shipped to you.
The rest are sellers that already sell on Amazon and ebay and just check the Walmart box in their listing management software to add a few more sales here and there. But without amazon and ebay, they wouldn't be able to maintain their business on Walmart, target, and probably about every other retail platform combined.
And I'm not even sure if ebay amounts to much any more. When I was in the business a few years ago, ebay did still account for maybe 20% of sales. I assume that has gone down, but likely varies depending on category.