If an attacker is able to gain access to the public key on a host server, they can setup a different machine between the client and the server, and place the key there.
When clients connect via SSH, they'll be presented with the same fingerprint as the original machine and their commands could then be intercepted by the attacker.
How does SSH avoid this?
Edit: this is in reference to passoword-less communication with the server