As far as the term “Uncle Sam” is concerned, the story I heard is that it originated in the early 1800s among American soldiers, whose equipment was stamped “U.S. approved” by government inspectors. The troops took this to mean “Our gear was approved by ‘Uncle Sam,’” supposedly a minor official, and the name stuck.
In the modern term “GI Joe,” the GI stands for “Government Inspected,” a reference to every soldier’s kit.
Yes, makin’ mock o’ uniforms that guard you while you sleep
Is cheaper than them uniforms, an’ they’re starvation cheap.
An’ hustlin’ drunken soldiers when they’re goin’ large a bit
Is five times better business than paradin’ in full kit.
Then it’s Tommy this, an’ Tommy that, an’ Tommy, 'ow’s yer soul?"
But it’s “Thin red line of 'eroes” when the drums begin to roll
The drums begin to roll, my boys, the drums begin to roll,
O it’s “Thin red line of 'eroes,” when the drums begin to roll.