Even when books are gifted they aren’t always shelved.
Most gifted books end up on the book sale tables (unless the library employees want them).
Most gifted books are not library quality (publishers print special books for libraries with special bindings and acid free paper. These books are more durable than the bookstore variety) and there for not considered appropriate for shelving in a library