Amazon doesn't co-mingle their inventory with 3Ps, they do co-mingle 3Ps that don't opt to avoid it. This is one of the reasons I look for the "sold and shipped by Amazon" for important purchases.
Unfortunately, I've never seen information about how Walmart handles this. Given their massive shift to 3Ps providing most of their products online...I'd imagine they use a similar strategy (it improves same/next day availability and lowers cost). I follow the same strategy with Walmart (try to only buy directly).