I would suggest that the second sentence is either wrong, or at least misleading. His habit is the subject, is biting is the verb. But really, is his habit biting, or is he biting? It is his habit to bite his nails. He bites, his habit does not bite. Habits do not do anything; they cause you to do something.
I believe that using the infinitive here helps to make that rather narrow distinction. Otherwise, when you use the -ing word, it is confused with the present participle (is running, is biting), rather than the noun (gerund) that you intend.
- For Teachers