The formula of humanity states that one should treat someone else not as a means but as an end by itself. A Nazi soldier wants to treat the Jewish innocent people as a means to his end. Therefore, there are two grounds for defending the action of lying. First, does the guard follow moral precepts? No, he clearly is following the orders of mass genocide. That by itself should be enough to grant that the categorical imperative does not apply to this situation. However, let’s imagine that we want to use the categorical imperative. Therefore, the second ground for the test is this: what kind of a society we would live in if our neighbors will give us up to an oppressive and murderous regime? Clearly a disastrous one where trust is crumbled. Therefore, a Kantian can maintain the formula of humanity — treat the Jewish people not as a means to an end — and lie to the Nazi soldier.
I do believe that this strategy is consistent with the formula of humanity. Mainly because one who decides to lie puts herself in danger because she treats the Jewish fugitives as an end and worthy of respect. Is the Nazi soldier rationally autonomous?
The main practical problem is the main issue at hand. If the Nazi soldier is able to conjecture the state of mind of the house owner and her reasoning, then he would know for sure that there is a lie and would forcefully search the house. However, I highly doubt that this is crucial for the house owner’s decision. We have to follow the good will no matter the consequences. Moreover, if the Nazi soldier is aware that there is a high chance of lying, then the house owner herself is aware of that. Therefore, she could do something to counteract this measure by hiding them more securely or making them leave to a better hiding place before the Nazi soldier arrives. If the Nazi soldier is rational and prudent, then there is no reason why we should not assume that the house owner is prudent herself.