How do efficient credit markets allocate capital properly? I've learned that efficient credit markets should theoretically allocate capital efficiently, which means that all possible investments should have the same marginal product of capital (assuming some type of concave production function). 

How exactly does that work? On the surface level, it makes sense that we should allocate more money to projects that have higher returns, but what would be the mechanism by which that happens? It seems like banks would have to charge a higher interest rate in Africa - and does that happen? I think I'm having a lot of trouble developing the correct intuition here.
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