Loans and other student financial assistance can and do include living expenses, not just tuition, fees and books. And living expenses are more than just food, clothing and lodging. I would think that a book could be considered under that category, especially for a college student!
If you are concerned about it, read the agreement you must have signed when you received the money. But I would think that if you have covered all your essentials, you are free to use the remaining money as you see fit.
Plus, even if not related to a particular course, buying a book can certainly be considered part of your general education and an investment in increasing your knowledge. And since you are using what little money you have available for it, I would believe you are not being frivolous with how you spend it.
So given all of this I don’t think there is a moral issue here.