a portion of it is materials, and another portion of it is how many they'll sell.
it's really easy to say "well it's just a pipe", but it isn't really. all the bends have to be just right, all the tabs, all the slip joints, the angles and fit have to be bang on. that means that the manufacturer has to produce jigs and fixtures to make sure everything fits just right.
if they aren't going to sell thousands of sets, the costs in setup and R&D have to be recouped through the sale of fewer units, so this is included in the price of the exhaust.
you'll notice that exhausts for less popular bikes are typically more expensive than others.
you'll also notice that really cheap exhausts tend to suffer from fit issues.
there is more to a product than what it's made of.