Question:
Can I buy a sefer during the three weeks and if yes, can I buy it even during the nine days?
Answer:
During the three weeks it is permitted, but not large purchases that one would make a shehechiyanu on it. During the nine days we may only buy seforim that are needed for learning during the nine days.
Sources:
Kovetz Halachos ( R' S. Kaminetzsky shlit"a 12-17, Kara Olay Moed 4-13 in the name of R' N. Karelitz and R' Chaim Kanievsky shlit"a.