Are all Ghost-type Pokémon the ghosts of Pokémon? Certainly not. Best way to sleuth this out is simply to read Pokédex entries on Bulbapedia (reading them all in-game would require about a dozen games):
Born from gases, anyone would faint if engulfed by its gaseous body, which contains poison.
Each of them carries a mask that used to be its face when it was human. Sometimes they look at it and cry.
A doll that became a Pokémon over its grudge from being junked. It seeks the child that disowned it.
According to old tales, these Pokémon are stumps possessed by the spirits of children who died while lost in the forest.
Ghost-type Pokémon are a collection of beings that are either literal ghosts (Yamask), poltergeists (Banette) or simply unusual beings that have properties similar to ghosts (Gastly). Some, but not all, Ghost types can actually be ghosts of Pokémon though. Drifloon is the only one I've found:
A Pokémon formed by the spirits of people and Pokémon. It loves damp, humid seasons.
Most Ghost types are simply referred to as being "spirits" that inhabited some sort of object or spontaneously generated some sort of body. "Spirits" is usually left ambiguous, though several entries specifically mention human spirits, and fewer mention Pokémon spirits. And many simply have no explanation for their existence (Duskull and Misdreavus. And Frillish which doesn't even make mention of any ghostly properties at all other than a grim malice).
The anime apparently has a "Ghost World" which is a home to Ghost Pokémon, which is implicitly the one mentioned in Dusknoir's Pokédex entries:
The antenna on its head captures radio waves from the world of spirits that command it to take people there.