In a sense, that is true. The electrons of the hammer repel the electrons of the nail, pushing them down a bit. That causes the nuclei in the nail to move downwards too, attracted by the nail ...