The opportunity cost of an investment is the real interest rate, and that's why investment demand depends on the the real interest rate. The effect of inflation "cancels out" because, although it increases the cost of borrowing funds, it also increases the value of the capital goods in which the funds were invested, which grow at the rate of inflation
The inflation rate shows the rate at which all goods and services in the economy grow in value. This, of course, includes capital goods. For example, ignoring depreciation, if ...
The inflation rate is emphasized. Why the value of capital good increasing at rate of inflation is determined.