I think diamondcutter is actually onto an interesting semantic distinction here.
I think that when we use verbs with a stative meaning, we tend not to use the preposition for, but when the verbs are not obviously stative (such as borrow and go in the posts above), then the preposition becomes (at least more?) necessary.
How long are you staying?
How long have you had it?
How long can I keep it?
The above are all perfectly fine without for, as they're all obviously stative. However, these are not so clear:
How long are you going (for)?
How long can I borrow it (for)?
How long did you rent it (for)?
I think that the fors are pretty much necessary in the examples above, as the verbs are not stative in meaning.
If the sentence How long can I borrow it? seems okay to a native speaker, I suspect it may be that he is interpreting the meaning of the verb borrow as stative rather than punctual, where it's identical to How long can I keep it?
In any case, in all the examples above, the for-phrase does not relate to purpose but duration.