It's like "I borrowed a textbook from my friend" (rather than "I borrowed my friend's textbook", which "no" would indicate). You may not have studied this yet, but it's similar to the use of ni with grammar patterns like "te morau".
As nekojita-san explained, "ni" or "kara" indicates the person you borrowed a textbook from, whereas "no" is for the owner of it. ("No" can also indicate the author of the textbook. It would be quite rare that your friend wrote a textbook, though.) They would be the same person in most cases, but it's possible that you borrowed a teacher's textbook from your friend or you borrowed your friend's textbook from his/her mother, so those two sentences are not the same.
かりる【借りる】
I
1 〔金品を〕borrow ((a thing from a person))
彼から金を借りた
I borrowed some money from him.
君に1,000円借りている
I owe you one thousand yen.