In simple terms, it is the lender who "loses money" (or rather loses value) on the loan due to inflation. The reason is that, as you say, most debt is not indexed to inflation. This means it is denominated in nominal dollars, but if inflation occurs the real value of those dollars later (when the debt is paid off) will be less.
Here's a simplified example. Lenny the Lender lends Barry the Borrower $100; the agreement is that Barry will pay back $110 in one year's time. At the time of the loan, hamburgers cost $5, so Lenny has lent enough money to buy 20 hamburgers, and the agreement is set up so that he will get back enough money to buy 22 hamburgers (but the actual agreement is in dollars and does not guarantee any hamburger exchange rate).
Over the next year 10% inflation occurs. Hamburgers now cost $5.50. At the appointed time Barry pays Lenny his $110. This $110 can now only buy 20 hamburgers, just as it did at the outset of the loan period. Thus Lenny has effectively lent the money to Barry for free, since he earned no interest in real dollars.
Obviously I've simplified matters here by assuming that inflation is only affecting the price of a single type of good, namely hamburgers. Also, as mentioned in other answers, whether Barry effectively "loses money" will depend on whether his income rises with inflation. (But as you noted in the question, wages are more likely to rise with inflation than debt payments, and also this loss of value is separate from the loan; the borrower may lose value because their salary goes down in real value, but they're not losing value on the loan itself.) And of course most actual loans have more complex terms than this simple "pay everything plus 10% all at once in one year". Still, this is the basic idea.
The essence of the situation is that a typical loan agreement requires the borrower to pay a certain number of dollars over time; if that number of dollars becomes less valuable, the borrower benefits and the lender loses out, because the purchasing power of the payments is reduced.