The key words here are "a basic" level of housing. A house in the most exclusive area of town will always be an investment (not necessarily a good one), because it primarily offers exclusion of other poorer members of the society from your surroundings, not habitation for yourself. It can't be affordable by definition.
But a basic level of housing is a human right, because it's a prerequisite for maintaining your humanity, ditto for healthcare.