1) The cost of ingredients is a major factor-- corn and rice are cheap adjuncts, so beer made from them is cheaper. Better beers don't use corn or rice, it's all malted barley or even more expensive grains like wheat. And then specialty beers might throw in even more expensive ingredients like vanilla bean or coffee.
2) Some of the "better" beers are aged longer, and in barrels, which is more expensive than the short aging times in vats used for cheaper beers. For example Budweiser is aged for 21 days, while an Imperial Stout might be aged for 3 months to 2 years. Fewer "turns" from your processing equipment leads to a higher cost of production by comparison.
3) Higher alcohol beers require more malt. A 10% Imperial Stout might require 2x-3x more malt than a light lager, which obviously adds to the cost.
And of course smaller craft breweries don't enjoy the same economies of scale in either production or purchasing that the larger macro-breweries have, so they'd end up spending more just to make the same exact beer, anyway.