It hasn’t. There hasn’t been a war in centuries where America didn’t obliterate its opponent. It loses politically because its people don’t want war, but it’s defeated militarily everyone it’s engaged with.
The term of art for losing politically is “losing”.
If you can not win a war because your population is unwilling to bear the cost, then you are still unable to win (that is in fact a very typical way for a war to end).
Nobody is disputing the fact that the US spends more money on arms than anyone else and has the shiniest of toys as a result, but "winning" in war is about effecting the outcomes that you want, not about whether your weapon systems are superior.
The US military has clearly failed to deliver the outcome that Americans wanted in many recent conflicts (Vietnam, Taliban); counting those wars as "lost" makes a lot of sense.