Because some cannabis is simply better than others. Thus, more expensive. EDIT: (long answer) Cannabis has different kinds of strains. Each strain has something unique. Maybe it's a different high, maybe its THC levels are higher, maybe its other levels are higher, but there's always something unique. Therefore, if you buy 2grams of a very potent strain, you will pay more than you will for a less potent strain.
Just like how some cocaine is 40 and some cocaine is 50. The more expensive is usually the better product. Get it?