Yes, there are games where you take on the role of a ghost.
One example given here is Lego Star Wars: The Complete Saga, which lets you play as ghost characters among its many playable figures.