I am going to slightly disagree with the other two answers. First, here is an excerpt summarizing Alton Brown's opinion:
The first step in learning how to cook with spices is learning where to find spices. Now here in America, we do have some indigenous spices: allspice, vanilla, chili peppers, all from here. But by and large, most of your culinary spices come from the other side of the planet. And in their journey from there to here, a lot of things can happen. Not all of them good. They pass through a lot of hands, and all those palms, you know, want to be greased a little bit, quality can go down. So, if you're going to be a world-class spice cooker, you really should try to find yourself a world-class spice merchant. … I sure hope we've inspired you to set up a little spice trade of your own. Just remember: purchase whole spices, whenever you can, from a reliable purveyor—Internet or mail order are fine—and store those spices in a cool, dry, dark, airtight place. And don't keep them around too long. Two years tops for whole spices, and no more than six months for ground.
So, to summarize, the most important thing about buying spices is making sure they are fresh and have been stored properly during their transport. That means buying from a purveyor whom you trust has properly sourced and handled the spices. If you go to a specialty spice merchant, chances are they care enough to ensure the quality of their product, and they charge you more for the convenience of that guarantee. If you shop at an ethnic market that buys imports its spices in bulk, that is okay, as long as the store has enough turnover to ensure that the spices are always fresh, however, you don't necessarily have the guarantee of freshness unless you trust the store owner. Supermarket spices can be okay, as long as they are stored and dated properly. These generally cost more not so much due to the willingness of buyers to pay more, but more due to the fact that there is a longer chain of wholesalers and middle men who all also want to make a profit.