Loans from banks are of two types:
1.A “goodly loan” (qard hasan) which does not involve any additional payment (interest); there is nothing wrong with this;
2.A loan with interest, which is riba, and there is scholarly consensus that it is haraam. It is not permissible except in cases of urgent necessity which cannot be met except by taking out a riba-based loan. The need for housing does not reach a level which makes it permissible to deal with riba, because this need can be met by renting. So it is not permissible to take out a riba-based loan in order to buy a house.
Ibn Qudaamah (may Allah have mercy on him) said:
“Every loan in which it is stipulated that something extra must be paid back is haraam, with no difference of scholarly opinion. Ibn al-Mundhir said: [the scholars] are unanimously agreed that if the lender stipulates that the borrower must pay extra or give him a gift, and he lends him money on that basis, then accepting the extra payment is riba. It was narrated from Ubayy ibn Ka’b, Ibn ‘Abbaas and Ibn Mas’ood that they forbade every loan that brings benefits, because loans should be given as an act of kindness and an act of worship aimed at bringing one closer to Allaah. So if there is a stipulation of extra payment, this diverts the loan from its purpose.”
This applies if the aim is take out a loan from the bank that clearly involves interest.
If the aim is to buy a house through the bank, this also is of two types:
1.The role of the bank is to finance the purchase in return for interest, so it pays the price of the house for you, on condition that you will pay it off in instalments in return for interest that will be taken from the bank. This is a riba-based loan and is haraam.
2.The bank buys the house for itself first, then sells it to you for a higher price, in instalments. There is nothing wrong with this, but it is essential that the contract be free of any stipulation of riba, which is the condition that a penalty be paid in the event of any delay in paying the instalments, because stipulating this penalty is riba and is haraam.
It is no secret to you that riba is a major sin, and there are stern warnings concerning it that are not given for other sins; Allah threatens war to the one who commits this sin and He told His Prophet (blessings and peace of Allah be upon him) that there is a curse upon the one who consumes riba and the one who pays it. This is a strong warning against falling into this evil.
“O you who believe! Fear Allaah and give up what remains (due to you) from Ribaa (from now onward) if you are (really) believers.
279. And if you do not do it, then take a notice of war from Allaah and His Messenger but if you repent, you shall have your capital sums. Deal not unjustly (by asking more than your capital sums), and you shall not be dealt with unjustly (by receiving less than your capital sums)”
Muslim narrated (1598) that Jaabir (may Allah be pleased with him) said: The Messenger of Allaah (blessings and peace of Allaah be upon him) cursed the one who consumes riba and the one who pays it, the one who writes it down and the two who witness it, and he said: they are all the same.
And the Prophet (blessings and peace of Allah be upon him) said: “A dirham of riba that a man consumes knowingly is worse before Allah than thirty-six acts of zina (adultery). Narrated by Ahmad and al-Tabaraani; classed as saheeh by al-Albaani in Saheeh al-Jaami‘, no. 3375
And Allah knows best.