As has been said, lawyers are not supposed to lie. Lawyers cannot use deception when trying to gather any type of evidence. However, a lawyer or their agents may impersonate ordinary people to determine if a crime is being committed. I rely on my experience as one of the best defense attorneys in my area to personally review all the information on this site; however, the information provided here should not replace legal advice.
There are probably hundreds of jokes about lawyers lying for a living, but no matter what the public opinion is, legal regulations prohibit lawyers from knowingly lying. The ethics of their profession also prohibit lawyers from asking clients questions if they know that the answer will be a lie. It's rare for this kind of thing to happen, but it's also rare for a lawyer to appear on public television questioning the sanctity of the United States elections on behalf of his client, who happens to be the president of the United States. In other words, an attorney cannot lie without violating the profession's ethical standards, which can result in disqualification.
While lawyers aren't allowed to lie, and most don't want to risk losing their license, they can use a small level of deception to help their clients for purposes such as gathering evidence. This is because attorneys rarely take an oath, since they don't testify in court unless they are accused of a crime, are a party to a lawsuit, or testify as a witness to a crime. Perhaps the most famous recent example of how a lawyer is punished for lying is the recent suspension of Rudy Giuliani's New York law license. On the one hand, the entire court system would turn into a disaster if it were simply determined which lawyer is best for lie.
For example, an attorney representing a company that believes that another company is infringing its trademark may pose as a typical customer to seize a portion of the merchandise with the trademark infringement. But in addition to helping courtrooms operate as effectively as possible, the ABA also wants to maintain the integrity of the legal profession, distancing lawyers from people known to lie. Usually, an attorney will try to convince their client not to commit perjury on the stand or not to testify at all. While it can be a slippery road, and you can't blame lawyers for aggressively asserting their clients' demands, the Giuliani case points out that Advocacy has limits.
If the client continues to insist on committing perjury, the lawyer will most likely ask the judge to get rid of the case without saying why. A good lawyer can seamlessly balance his responsibilities to his client with his obligations to the court.