first formulation of the categorical imperative: "Tell lies" cannot be willed as a universal law. Lies only work when the person being lied to does not know it is a lie, but if lying was universal then no one would believe any lie. This is a contradiction in conception, and so not lying is a perfect duty.
second formulation of the categorical imperative: to lie to someone is to prevent them from being able to make fully informed, rational decisions and so is treating their humanity as a mere means, so it is wrong.
Benjamin Constant challenged Kant on lying, he said: if there was an example of a murderer asking where your friend was, To tell the truth then is a duty, but only towards him who has a right to the truth. But no man has a right to a truth that injures others. Kant responded to him directly: He says if we tell the truth then no matter what happens next we cannot, be blamed as we have followed our perfect duty. But if you lie and as a result something bad happens, then you are at fault as you made the decision to mislead.