This is probably as variable as the educational system generally. But I'd doubt that more than a few professors get special allowances for such things.
Some of the books you see are text books given to professors by publishers in hope that the professor will adopt them for a class. Some of them are "ancient" texts that the professor used as a student back in the ice ages.
Some quite useful advanced books might be given to a professor by some publisher when the professor adopts some elementary text. It is a form of bribery, I suppose.
When professors retire they sometimes open their own bookshelves to their colleagues (or students) who are free to carry away things that interest them. Some books actually wind up in boxes outside a professor's door and others are free to expand their own libraries with them. Sometimes such books actually have some educational value.
Some of the books are funded by grants also, but normally grants from funding agencies outside the university.
A few new professors will get some "start up funds" from a university department and while intended for bootstrapping research, books and papers are part of that.
I accumulated hundreds of books over the many years. Some were donated to educational systems in Kenya eventually. But I still have far too many. No one other than publishers ever funded them, however.
Generally, however, the salary of a professor should be high enough to support quite a lot of such things out of pocket. I paid for professional memberships myself, for example, which generated a lot of journals on my shelves.