On page 85-86 of Xanathar's Guide to Everything, Invalid spell targets, there's a ruling that would seem somewhat relevant to this issue:
A spell specifies what a caster can target with it: any type of
creature, a creature of a certain type (humanoid or beast, for
instance), an object, an area, the caster, or something else. But what
happens if a spell targets something that isn't a valid target? For
example, someone might cast charm person on a creature believed to be
a humanoid, not knowing that the target is in fact a vampire. If this
issue comes up, handle it using the following rule.
If you cast a spell on someone or something that can't
be affected by the spell, nothing happens to that target,
but if you used a spell slot to cast the spell, the slot is
still expended. If the spell normally has no effect on a
target that succeeds on a saving throw, the invalid target
appears to have succeeded on its saving throw, even
though it didn't attempt one (giving no hint that the creature is in fact an invalid target). Otherwise, you perceive
that the spell did nothing to the target.
The only caveat of the above rule is that it specifically refers to invalid targets, not immune ones. It even uses an example of trying to use a spell targeting humanoids on a non-humanoid in disguise, thus an invalid target by the spell's targeting rules and not due to the target's innate immunity. A rakshasa is a creature, and thus still a valid target for spells like Zone of Truth. As such, this might not be applicable strictly RAW.
As for RAI, I'd still say it sets the precedent that DM could always hide any sort of immunity they do not wish to explicitly reveal to the players behind the guise of a successful save.