Partly true, the actual reason is that it is mostly due to the sound the hit produces.
Just like a guitar and picking the string at the bace of the guitar by the pick ups.
There are alot of physics behind this however, I'll cut that and tell you the simple stuff. Lots to do with the nodes of the sine wave produced and the fundermental frequency and harmonics of the Key.
But it simple terms, if the key is hit in the centre of the string, the sound that it produces is not as pure tone as it is if you hit the key at the end of the string. If the hammer hits in the centre the wave travels in two directions from the hit, creating two tones, if the hammer is closer to one end then the other, the sound on one side will be a different tone from the other side and produce a aweful two tone sound.
because of that the key hits the end of the string, so that the sound produced is that of the whole string creating a pure tone key.
If you wanna test it out simply open up a piano and hit the centre of the key, if you have keen ears, you'll pick up the difference.
hammers hit the strings in the middle by: Ido from www.piano-play-it.com
Hello MC,
Upright pianos are built in a way where the keyboard is positioned more or less at the middle of the body of the piano. This is so to enable you to play while sitting comfortably. Each key is connected to a lever which connects it to a hammer and the hammer hits the strings. The lever is positioned upwards to the string, and that is why the hammer hits on the upper end of the string.
As for grand pianos the strings are horizontal. If the hammers were to hit the strings in the middle, the lever would be too long. This would cause instability of the lever. Therefore the hammer hits the string closer to the keyboard.
We have < a href="https://www.piano-play-it.com/piano-techniques.html">an excellent page which explains how the piano works.