How are airspace violations detected?
The transponder usually uses its own pressure reading, not what is set in the pilot's altimeter. So to prevent cheating as you describe, it is inspected and calibrated every 24 months. Tampering with it would be difficult to do on the fly because you'd have to adjust it based on the current atmospheric conditions and what altitude you want to seem to fly at. But yes, you could, in theory, adjust its readings to broadcast something different.

As far as I'm aware, only major violations are really pursued, or if ATC knows who you are when you commit the violation.