This law is about lying during interrogation. When a police officer is wearing the uniform, asking questions, acting in their capacity as a protector of the public, I think directly lying to your face should be a crime. Their authority as an officer is the very thing they are using to get you to believe their lie. That is a critical piece.
A detective doing undercover work may require a degree of duplicity to achieve their aim, their authority as an officer is not what gets you to believe their lie, they almost always conceal that fact from you.
I think these are clearly distinct arenas of law enforcement.