His statement, “It is permissible to use them for lamps outside a mosque”: the pronoun “them” refers to the nearest antecedent, namely contaminated oils.
“It is permissible to use them for lamps outside a mosque” …
“It is permissible to use them for lamps” means using them as fuel for lamps.
How was this done? In the past, people had neither kerosene, gas, nor electricity. So what did they use for lighting? They used oils: they would take oil, place it in a small vessel, put a wick in it, and light it. As long as the oil remained, the flame would continue to burn. Thus, the author says, “It is permissible to use them for lamps outside a mosque.”
His statement, “It is permissible to use them for lamps,” is a parenthetical remark, for the discussion here is not about whether using them is permissible, but whether selling them is permissible. Yet he mentioned it in passing. Such parenthetical digressions in scholarly discussions, when required by need or warranted by benefit, are part of the Prophet’s guidance. An example from the Sunnah is that the Messenger of Allah ﷺ was asked about performing ablution with seawater, and he replied: “Its water is purifying, and its dead animals are lawful.” (1) No question had been asked concerning its dead animals, but he mentioned this because the benefit called for it.