A very good post on Strat Page regarding the F22 and the cost of upgrades, original program and maintenance. It concludes with these two paragraphs which I think clearly state the problem.
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). Developing this new technology takes longer in peacetime, which also raises the cost, and 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, or less. In other words, a tenth of what it actually cost. Same deal with the mythical $35 million F-22, or any other high tech weapon.
Other nations have adapted more effectively to peacetime development conditions. But the United States has the largest amount of peacetime military research and development, and this has created a unique military/industry/media/political atmosphere that drives costs up to the point where voters, politicians and the media will no longer support them.