After almost a decade, I think I can add some words.
I have noticed it is usual in some cultures and places to allow "white lies", lies with a good intention, or lies said under duress, or any such circumstances.
However, many people with some contact with Philosophy of Ethics can readily quote some serious philosophers that defend the idea that lying is always intrinsically wrong, from the Thomistic tradition to the Kantian one, and reject the former, more utilitaristic approach.
This obviously generates a problem similar to that we find here: how is it possible that Rahab is being listed at the Hall of Faith, and even figured in the genealogical tree of the Messiah when she obviously committed the sin of lying?
The most readily available answer, Rahab lied but because of her noble intentions and her tremendous faith she was forgiven, is a cheap solution and can be valid, however it is not satisfactory, because in a certain sense it would make God (the One really interested that the people abide to the moral law) a bit utilitaristic, defeating the whole premise of rejecting utilitarism.
The other possible answer that I will defend here is that Rahab was skillfully employing a misleading truth (a statement true in and by itself, but ambiguous to the extent that it can be possibly interpreted in a misleading way). In other words, she concealed the truth by speaking truths.
First, the word employed in Joshua 2:4 for hid is 6845 Strong, whereas in the verse 6 the word is 2934. 6845 is employed in Exodus 2:2, describing way Moses was hidden by his mother, whereas 2934 is employed in Exodus 2:12, describing the way Moses hid the men he slew. Certainly the two words are synonym, however synonym words are not the same as identical words. We can compare and trace parallels between these two events (Moses and Rahab). Rahab and the mother of Moses was hiding something important and favourably to the people of Lord of Heaven. To be even more accurate, she hid the truth with a smart, sexually-loaded wording.
In Joshua 2:4-5 the word translated as know is Strong 3045 usually employed in a context of intimacy, especially sexual intimacy. As we know the event happens in a burlesque house, it is entirely plausible to say Rahab was telling that she did not know where the spies were from the usual way harlots "know" men. Indeed, if ex hypothesi she had sexual intimacy with these men, she would know a plethora of things about them, especially their circumcision, and she would know where they were from.
Knowing (intelectually) that Rahab's house was in the side of the wall, it was likely a place with a great flow of diverse people, therefore it is perfectly plausible that her services would be negated, especially if these men came and gone. (We should also remember Rahab lived there with her family too.)
Joining all the pieces, we can conclude with a high degree of accuracy that Rahab was concealing the spies while denying that she sexually engaged with them.