Some can, not all — and the original advice to test carefully on a new game first is exactly right.
A GameShark works by writing to memory while the game runs. Badly formed codes can write outside the intended address, and on cartridge-based systems that can corrupt the save block. The most common outcome is a lost save rather than a physically broken cartridge, but a corrupted save on a long-played RPG is painful enough.
The hardware itself rarely fails from this. It is the data that is vulnerable, so treat saves as the thing worth protecting.