Your average bookstore makes like 5% profit (if they're not losing money). Barnes and Noble could become a non-profit tomorrow and prices would go down so little you wouldn't notice. It's not profit versus non-profit that means the difference between "affordable" and "unaffordable." It's the ability to use tax dollars to offer a service for a fraction of what it costs.
Libraries don't.