If Walmart could be making more money on interest from their cash flow, they would be already be making more money. It is not a novel or difficult idea.
The profit margins of the business of retail is not in the MAMAA league. Being a retail middleman is simply not as profitable as what the tech companies can do because they can scale at extremely low marginal costs, and barrier to entry is very high.
Amazon’s value lies in AWS and prime video/music/logistics/platform, not the part where you buy something shipped and sold by Amazon.com. Hence why Amazon removed the button to filter searches to only items shipped and sold by amazon, and why Walmart introduced their own version of a platform where they can make money as a platform, rather than a retailer.