Amazon’s sales and those of third-party sellers on its platform eclipsed Walmart’s over the year ending in June, making the e-commerce giant the world’s largest retailer outside China for the first time.