God never says it's a sin to lie. It is sinful to bear false witness which is a type of lie that incriminates another person or possibly helps a guilty person be freed from his crime.
But lying in and of itself is morally neutral. Lying can be a bad thing... or it can be a good thing based on the circumstance.
A fantastic example of this concept can be found here...
Exodus 1:13 So the Egyptians made the children of Israel serve with rigor. 14 And they made their lives bitter with hard bondage — in mortar, in brick, and in all manner of service in the field. All their service in which they made them serve was with rigor. 15 Then the king of Egypt spoke to the Hebrew midwives, of whom the name of one was Shiphrah and the name of the other Puah; 16 and he said, “When you do the duties of a midwife for the Hebrew women, and see them on the birthstools, if it is a son, then you shall kill him; but if it is a daughter, then she shall live.” 17 But the midwives feared God, and did not do as the king of Egypt commanded them, but saved the male children alive. 18 So the king of Egypt called for the midwives and said to them, “Why have you done this thing, and saved the male children alive?” 19 And the midwives said to Pharaoh, “Because the Hebrew women are not like the Egyptian women; for they are lively and give birth before the midwives come to them.” 20 Therefore God dealt well with the midwives, and the people multiplied and grew very mighty. 21 And so it was, because the midwives feared God, that He provided households for them.
Note, that the Hebrew midwives lied to the King to protect the baby boys.
God, not only allowed such a lie but He blessed the Hebrew midwives for lying to protect innocent children from certain death.