While it comes as a surprise to many people, law enforcement officers are permitted to lie to suspects, for example, to secure confessions. Prosecuting attorneys (who are lawyers) and other lawyers do not have this option available to them, and must always be truthful, even to crime suspects who could harm members of the public.
But, at other times, law enforcement officers are required to be truthful, although the remedies for these violations vary.
Law enforcement officers are not allowed to lie when testifying as a witness, but may not be sued for lying when testifying as a witness (under an absolute immunity from civil liability for such conduct). Criminal prosecutions for perjury and a judge's contempt powers are the only remedies for lying under oath at trial.
More subtly, at least in the 7th Circuit (contrary to the position taken by the federal government in the linked case) they are not permitted to lie when providing facts to a prosecuting attorney that are used as a basis for the prosecuting attorney's decision to prosecute (and may ultimatley be passed on to a court in the form of an affidavit).
Lying in the course of providing facts to a prosecuting attorney is actionable in a private civil action for malicious prosecution seeking money damages, even if the liability for the decision to refer the case for prosecution itself is barred by the principal of governmental immunity.