I though sandbags were just so bullets wouldn't ricochet and hit the turret gunner.
Well, first off, noone in they're right mind would shoot their rifles and/or mgs at a tank. One, it would certainly have no effect, and two, it would reveal you're position for the Sherman to shoot at you.
Second, the sandbags, wire mesh, chicken wire and armor plates we're all improvised defense vs the german infantry AT weapons, mostly panzerfausts and faustpatrones, which despite very low range, had a pretty good shot at knocking out any tank (panzerfaust 60 could go through 200 mm of armor). The sandbags wer're put with the purpose of stopping the HEAT warhead to punch through the armor, but off all the cases I've read, heard and saw documented, no upgrade installed on both Sherman or T-34 could prevent the HEAT warhead of going through, which is why in 44-45 all tank regiments going in close quarter combat, like street fighting for example, had to be escorted by infantry, snipers and even some times flamethrowers to smoke out the panzerfausters so that the tanks could shoot at the intended targets (like blockhouses turned fortresses) from safety.
Cheers.