It was a popular belief that churchyards were favorite haunting grounds for ghost. The belief was vividly fueled by imagination that the ghosts are spirits hoovering over their buried bodies.
Antiquity gives some credence to such a belief.
The ancient Greeks thought the souls of the dead were particularly powerful near their graves or sepulchers because of some natural tie between the soul and body, even after death. The more gross and earthly the soul was, the less willing it was to leave the vicinity of its body. Thus came the belief that specters met in churchyards were to be more feared than those met elsewhere. However, there is an exception, the apparitions witnessed at the tombs of the saints are to be considered good angels rather than the souls of the saints themselves.