I don't think asylum seekers are typically considered illegal immigrants. I think that's more individuals who either don't seek legal status, or have tried to get a legal status but failed and stayed in the country anyway.
And I don't think Sweden and Germany are giving free housing to individuals that overstayed their visas.
They get not only free housing, but also free food and even a janitor! That’s better than significant part of the population does. Do you think, that delivery driver or a nurse can afford more?