I wanted to buy some mini marshmallows recently, so I went on Amazon. Perhaps because of their resemblance to packing material—light, bulky, ubiquitous—I figured they’d be cheap. But when I found the most popular brand, not only did the marshmallows cost twice what I’d pay at my local store, the price had skyrocketed overnight.

Just beneath the placid surface of a typical product page on Amazon lies an unseen world, a system where third-party vendors can sell products alongside Amazon’s own goods. It’s like a stock market,...