Ghost spying during religion/guild combat is only legal if it is done by a character in the opposing guild/religion. Anyone else caught loitering inappropriately will face an immediate 1-day jail.
EDIT: The point of this rule is to ensure that if someone is ghost spying, they are effectively out of the combat. Indoccing some newbie character to act exclusively as a spy is also illegal (and they will end up with a 1-day jail).