So that means that if firm B is Muslim owned and it gives firm A which is not Muslim owned a loan, accepting interest from them is halal?

Correct