As it vibrates, we turn the tuning peg in a way that reliably converts the horizontal motion into vertical motion, regardless of the details of how the peg is turned.
Without the proper amount of friction to hold the peg in place, a tuning peg will tend to slip, making a tuning setting virtually impossible to maintain.