Beginning in the 19th century, the purpose of a ghoul was to steal bodies for medical research. Prior to that time, ghouls lived largely in the myths and legends of different cultures as supernatural beings that ate corpses.
In the 19th century the term "ghoul" was used to refer to a resurrectionist, one who stole the corpses of the deceased and sold them to medical schools and laboratories for research purposes. In addition to stealing bodies, some of these ghouls killed people to create corpses to sell.
The ghouls of folklore were often living things that preyed on solitary people, killing them and eating their bodies. These ghouls were also thought to haunt cemeteries to steal freshly buried corpses for food.