Is taking out a loan like this

I thought about taking out a loan and then using money from someone else to pay it back and then keep doing that so I can basically have as much money as I want but nothing crazy like a million or anything but someone said I can go to jail for it but how is this illegal it it’s not stealing anything and it’s not really a crime so is it okay or not