They’re limited to a certain number of loans before the library has to buy another license, or a per-checkout fee. Physical books have about a 50 to 100 checkout lifetime and ebook licensing is similar.
There are quite a few different purchasing and lending models libraries use today. Outside of the big 4/5 publishers, many publishers will sell ebooks to libraries using a sim use model (pay 1 subscription fee and checkout as many times as possible over the period), and some will even let the library buy in that model perpetually.
I think a more apt example is, if the library started printing the books and giving it out themselves.