Well… you can, you just need to make sure that your state-changing code is made contingent on the phrase not being run because text is being ‘expanded for comparison purposes’.
e.g.
unless expanding text for comparison purposes: now magic-statue-examined is true.