What do B-2 bombers and nuclear submarines have in common? Both cost about the same and both require periodic, and expensive, refurbishment. The U.S. B-2 bomber is the most expensive warplane ever to enter service. The 21 that were built ended up costing over $2 billion each. About half of that was development expense. At the time these aircraft were built (in the 1990s), they cost as much as a major warship. The B-2 has similar needs, including periodic (every seven years), lengthy (13 months) refurbishment (programmed depot maintenance, or PDM). Most of the PDM is devoted to refurbishing structural stealth features. PDMs, upgrades and operating costs nearly double the cost of each B-2 over its service life (30 or more years). There are 19 B-2s in service, and one used for R&D. One was lost in a 2008 accident.
The U.S. B-2 bomber takes a lot of heat for its high price. Actual construction costs for each of those aircraft was about a billion dollars each. Still pretty high, mainly because a lot of special machinery and factories had to be built to manufacture the many custom components. The air force likes to point out that if the original (1986) plan had been followed, each B-2 would have cost half a billion dollars each. But then the entire program would have cost $58.2 billion, versus $44.3 billion for the 21 plane program (which included $10 billion more R&D expense).
New technology gives a weapon, especially an aircraft, an edge in combat. But since World War II, most military technology has been developed in peacetime conditions. This means it is more than twice as expensive, as there is no wartime urgency to overcome bureaucratic inertia (and emphasis on covering your ass, which is very time consuming and expensive) and hesitation (because you don't have a war going on to settle disputes over what will work best). As a result, developing this technology takes longer in peacetime, which also raises the cost. Worst of all, fewer units of a new weapon are produced (driving up the amount of development cost each weapon will have to carry.) If several hundred B-2s were produced under wartime conditions, each aircraft would have probably cost $200 million each, or less. In other words, a tenth of what it actually cost.