With Amazon now gobbling up more than 40 percent of all online spending in the U.S., that’s left traditional retailers scrambling for the rest.

Walmart Inc., Target Corp. and Best Buy Co. have all made big investments in recent years in e-commerce — sprucing up websites, offering more delivery options and making acquisitions like Walmart’s $16 billion deal for India’s Flipkart. But growth rates are naturally slowing as their online units mature, and all that spending is taking a…