In fact, there is no involvement in either case, neither direct nor indirect. The most that can be said is that there is an appearance of involvement, but appearance and reality are two different matters.
In the first part of the question, the transaction of sale is compliant in every aspect with the teachings of the Shari'ah. It takes place between two compentent parties, there is an offer and its acceptance, the object of the sale (a home) is itself halal, and the purchase price is paid by halal means, or cash. The subsequent uses to which the seller may put that cash is of no legal consequence to the sale. The seller may give it to the poor, or he may spend it on sin. In either case, the sale of the house is valid, and the buyer may rest assured that s/he has done nothing wrong.
The same is true in regard to the second part of the question because there, again, the sale is completely Shari`ah-compliant. Even though the buyer has financed his end of the deal by means of a mortgage, the bank with which he has contracted, or the mortgage company, will pay cash to the seller. In this manner, then, the transaction described in the second part of the question will be perfectly halal.
While the caution on the part of the questioner is to be admired, it must be understood that a Muslim is responsible for ensuring that his or her transactions are halal. Beyond that, money will pass through the hands of all manner of people, honest and dishonest, just and unjust, and for all manners of purposes, halal and haram.
In his work entitled The Book of the Halal and the Haram, Imam Abu Hamid al Ghazali wrote:
One who knows for a certainty that the wealth of the world has definitely had the Haram intermixed with it need not abstain from buying and selling, or from eating, because that would be an undue burden. And Islam is not a burden. This is attested to by the fact that in the time of the Prophet of Allah, Allah bless him and grant him peace, when a shield was stolen, and when an abba was misappropriated from among the spoils of war, no one refrained from buying shields or abbas. The same applies to anything stolen. Likewise, it was known at that time that certain people were making usurious transactions in dinars and dirhams, yet neither the Prophet of God, upon him be peace, nor his Companions refrained from dealing with dinars and dirhams. Essentially, then, the world will be free of the Haram only when people stop doing wrong, and that is impossible.
The Institute of Islamic Banking and Insurance (IIBI - London UK)