The person getting the loan obviously values money now more than total amount of money, for some reason (which may or may not make this preference entirely voluntary).
The person providing the loan values total money more than having constant availability of all their money (ie. they're investors). And I'm sure you would argue they also value more money more than ethics/decency.
Ie. the reason the economy works is that while price may be the same between buyers and sellers, value is subjective. Therefore it is a win-win in that both parties increase their perceived value through this transaction. This is also how a mortgage works, for instance.