You see this in movies and westerns. After the gunfight, the town coroner will prop the body upright in an open casket and put coins on the eyes. Did this actually happen and if so what purpose did it serve?
There are a lot of websites on this but none is definitive; this one is of interest. In general, we can say that the practice is widespread, functionally, as a means to keep the eyelids from snapping open after death. The coins are often fused in the popular mind with the coin placed in the mouths by the ancient Greeks, providing payment to the ferryman to cross the river into Hades. That connection may or may not be valid. What is clear is that other cultures did this before the settlement of the Old West.