Not long ago -- maybe 10 years -- supermarkets played "elevator music" by Muzak, while coffeehouses were associated with more energetic and exciting music than that. (I put quotes around elevator music because when was the last time you actually heard it in an elevator?)
Now it's the other way around. Whoever programs the music at Starbucks' headquarters has been diligent in avoiding exciting music -- they skip over 1920s jazz but include stuff from the mid-'30s through the mid-'50s, leave out the late '50s through the early '90s, and include the mid-'90s to today. Every once in awhile it's broken up by some OK reggae or Smiths songs, but the overall vibe is soporific. In supermarkets -- whether mainstream ones or Whole Foods -- you actually hear rock music. Sometimes it's lower-quality stuff like Candlebox or Creed, but almost as often it's Hall and Oates or The Cars.
And it's not necessarily the lowest-common-denominator song by the group as you might expect: in the perfectly middle-of-the-road grocery store that I go to, I've heard "What You Need" and "Listen Like Thieves" by INXS, "Lucky Star" by Madonna, and "Major Tom" by Peter Schilling. (Although I really wish my supermarket would stop blasting so much metal and play something with a beat by Ministry...)
This reversal would have seemed unimaginable just 10 years ago, but given how new it was to have music playing in every public space, it would've been miraculous for them to have gotten it correct at the start. They needed some trial and error to figure out what kind of music best fit their business and would boost profitability. And that seems to have been settled, for now anyway.
It seems like people in coffeehouses don't want to be distracted by exciting high-quality music because they're there for some other purpose, and one that involves some degree of focus and lingering -- to chat over the phone or in person, read, write, have a business meeting, etc. Some music is OK just to drown out the other potential distractors, like keyboards clacking, but it shouldn't be exciting enough that you focus more on the music than on what you came there for. Also, by playing boring music the coffeehouse gives you a little motivation to hurry it up and free up the space you're hogging for new customers. With great music playing, you'd be there all day.
Supermarkets, on the other hand, are places where you make up a short list of goods you want to grab off the shelves, swipe a credit card at the cash register, and get the hell out of there. How can the business keep you there longer to linger over the dazzling variety of stuff? Well, not by playing Muzak, which just makes you angry. By playing relatively exciting rock music, they can distract your mind well enough that you forget what exactly you were supposed to be going after, and why don't you stay here just a little longer till the end of this song? Unlike coffeehouses where customers have few options to choose from and generally have a regular drink, supermarkets offer a cornucopia of goods from which customers like to mix things up each time they go there. Impulse buys are better suited to supermarkets, for example. And how else to get customers in an impulsive shopping mood than to play some carefree, fun-loving rock music?
That would seem to be a general principle, then: expect more exciting music where you don't focus so deeply and where you tend to get in and get out, and expect more drowsy music where you tend to have a definite purpose requiring focus and where you tend to linger. Obviously this only applies to background music in a business that sells something else, not a dance club for example.