It will always be the balance of greed and requirement, mostly.
Everyone uses the same stock (Fruit of the Loom, Gildan, etc.), and printing is always going to cost broadly the same for most bands, less for the likes of Iron Maiden because they print in higher quantities, so it's all about how much profit they want to put on top.
Sometimes smaller bands need to charge more because it's the only way they're going to recoup the costs of touring, or because their record is selling, or something like that. With big bands, similar concerns exist, like cost of touring, but there's a bigger greed element with them.
In terms of support, I don't know if the same hard-and-fast rule occurs in the US, but here they almost always have to charge whatever the headliners are charging. It's why you should never, for example, buy the shirt of a band supporting Iron Maiden, because the same shirts will probably be cheaper at their own headlining shows, or when they support someone who charges less for their own shirts.
Prime example: Symphony X supporting Dream Theater in the UK and were forced to charge £22 (~$35) for their shirts because that's what DT were charging. They were able to book their own headlining tour a few months later off the back of that, and charged £15 (~$23) for the same shirts, plus the tour shirt.
By and large though, sellng merch is a touring band's best source of income, so the mark-up will reflect how much money they need to make in order to offset all their other costs.
30/7 King Diamond
1-2/8 BiesenRock Festival
3/8 Lokerse Festival