Playing my Not A Gifts-and-Acquisitions Librarian card before I try to answer...
In general, library gift/donation/bequest policies make crystal clear that the library is in no way obligated to accept, much less keep, much less preserve, any gift or bequest of books given it. If libraries had to keep every bequest of a library-lover, we'd drown in ancient duplicate National Geographics. It's just not on.
Unless a willed collection contains extremely rare or valuable books, any kind of bequest with "you must keep this collection intact" strings attached would be declined -- and even one containing such paragon books would only be accepted with a heavy sigh. Shelf space is neither free nor infinite. Cataloging is expensive. Current, popular, quality books tailored to the library's patron base should not be crowded out by books that are none of those things but came with a legal obligation attached.
In the normal course of things, a bequest of books would be winnowed for no-hopers by gifts/acquisitions librarians, then the remainder scrutinized by the library's collection developers, who would make a per-book keep-or-toss decision (where "toss" might well mean "sell," for a book with monetary value but little use-value to the local patron base). Books that duplicate the library's existing collection will typically be kept only if demand warrants an extra copy or if the bequest copy is in better condition than the library's copy, in which case it would likely replace it.
For non-duplicate books, the chances of an additional "loaner copy" being purchased are minimal to zero, though digitization may be a possibility if the condition and copyright status of the book permit. Ranganathan's First Law of Library Science: Books are for use. Not for sentiment, not for display alone, use. If nobody's going to use it, most libraries won't keep it. (The exception is research libraries, whose mission includes perpetual access to the scholarly record -- and even they are starting to do this work consortially rather than individually.)
If a book is legitimately rare or otherwise valuable, an academic or research library will generally route it to the Special Collections department, where it will receive a heightened level of care and security (which, alas, often means somewhat lessened access; I'll let special-collections librarians elaborate on this). Since special-collections departments have subject specialties, some book-trading goes on among them; a rare book may hop to a library where it fits better with what else is in special collections. Some public libraries or their consortia may have special collections, but most will sell such books on, knowing themselves less in need of them and unable to care for them properly.