Military budgets were higher as a result of Iraq and Afghanistan, but you'd have to count the entire military budget as "war costs" to reach even $4T, much less $6T.
Well, it adds up pretty fast when you look at the lost productivity of the men and women who went to fight and the fact that now we're on the hook for a lifetime of medical care for every single one of them, plus other benefits, and a lot of them came back very broken, with pieces missing and will require expensive medical care for the rest of their lives.
When you see the $4-6 trillion figure for the costs of the wars in Iraq and Afghanistan, you're looking at more than just the cost of bullets and MREs. The notion of True Price Accounting, where you look at the externalities of a product, service or government policy, is actually quite useful. It gives us a good idea of the true costs of things. A former CIA guy named Robert David Steele has written a few books on this topic and they're quite illuminating. He's also the guy who wrote a book called "Open Source Everything" which is a very interesting take on government and information.