Hyman Lipman patented the pencil with an eraser on top.

His patent included a metal ferrule to keep the eraser in place.

Source