It depends on the use of the instrument. For this comparison, I am trying to be as fair as possible. So I am comparing a piano and a keyboard with touch sensitive keys. To develop as a player it is important to have the instrument respond softly if you play gently. Or if you strike the key harder to have the instrument respond more loudly.
It is possible to learn to play using either instrument. Most students who play a piano have a wider variety of sound color at their fingertips. Students who play a keyboard have to work a little harder to develop it.
The most important key in learning to play is to use the instrument. Family environment matters no matter which instrument you have. Putting the piano in the same room as a tv creates family hostilities and a barrier to practicing.
So if someone works shifts or there is a new baby, having a keyboard with headphones is a kind way to practice and keep everyone happy. Some students will end up with one of each. A piano in the family room and a keyboard in their bedroom.
Can you hear the difference?
Sound Samples provided by a student who has been playing for three months.