The Bible does contain narratives of people’s actions without commenting on the appropriateness or sinfulness of their actions. Below are a couple of examples.
In Exodus 1:17-19, the king of Egypt issued a decree of killing baby boys that directly opposed God’s moral law that forbids murder. The Egyptian midwives disobeyed Pharaoh’s command and were not honest with him. Christians know that if they encounter conflicting commands from people and God, they have every reason to side with God (Acts 5:29).
On the basis of Joshua 2, children of God may sometimes wrestle with the possibility that their truthful statements will be used for harmful and ungodly purposes. While not necessarily commenting on Rahab’s particular course of action in Joshua 2:4, the inspired writer to the Hebrews provides this description of her interaction with the spies: “By faith the prostitute Rahab, because she welcomed the spies, was not killed with those who were disobedient” (Hebrews 11:31).
While Scripture alone is the source of our faith, explanations of our faith by fellow Christians can be helpful. So, in that way and within the context of your question, Martin Luther understood lying as withholding the truth from people who are entitled to it. We have to ask: were the kings of Egypt and Jericho entitled to the truth, since they were going to use the truth to oppose God’s will and plans? Christians might answer that question in different ways, but one of those answers is “no.”
In regard to Rahab’s actions, the People’s Bible Commentary for the book of Joshua lists (pages 35-36) some helpful truths to keep in mind about her:
1) Her purpose and motive were in line with God’s revealed will.
2) All forms of deception are not necessarily immoral. (Cf. Exodus 1:17-19; 2:1-10)
3) The New Testament commends her faith and refers to her actions as fruits of faith. (Hebrews 11:31; James 2:25)
4) She was new to the faith and needed to determine a godly course of action quickly.
5) The cultural practices of her day meant looking out for guests.
6) We could always do something better with the benefit of hindsight. If our course of action is wrong, we rejoice that we have a Savior who was perfect in our place and has paid the debt of our sin and guilt.