Like the B-2, the F-22 'failed' in terms of affordability because they massively cut numbers. It takes exactly the same amount of development work to build 187 F-22s as it does 750 F-22s and if you divide the cost of that work by 187 instead of 750 guess what. Ditto for the B-2, divide the cost by 21 instead of 140 and same again. The end result is that the F-22 costs what the B-2 should have cost and the B-2 costs as much as an aircraft carrier (nearly). The other factor is that they tried to make the F-22 politically bulletproof by building bits and pieces in 41 different states, which just created a cluster**** that even Eurofighter GmbH would be proud of.