How do efficient credit markets allocate capital properly?
Under the usual assumptions of decreasing MPK and complete markets in equilibrium $MPK_{Firm_1} = MPK_{Firm_2} = r$. If firm i's MPK is larger than r and firm i does not face constraints with respect to scale, if will simply borrow more capital as it can make a net return of $MPK_{Firm_i} - r$ on every unit for which  $MPK_{Firm_i} &gt; r$. If $MPK_{Firm_i} &lt; r$ firm i will divest until $MPK_{Firm_i} = r$.

There are many reasons for which this nice result can break down in reality (Deviations from the nice assumptions above). For example agency costs (Bernanke, Gertler, and Gilchrist (1996)), where an entrepreneur can only borrow up to the present value his net worth at end of the loan contract. If an entrepreneur does not have enough wealth he cannot borrow enough capital to achieve $MPK_{Firm_i} = r$. Hence when talking about this topic you should make your assumptions known in advance.

With regard to you question about Africa, from the point of view of the setting described above too few capital is flowing to developing countries. This fact has been known for a while and is referred to as the "Lucas paradox" or the "uphill flow of capital" a recent summary on the topic can be found here:

enter link description herehttps://voxeu.org/article/revisiting-paradox-capital