The Ritual Caster feat gives you a ritual book, but a ritual book does not give you the feat
You should note that the Ritual Caster spell specifically says
When you choose this feat, you acquire a ritual book...
In other words, the assumed rule is that taking the feat gives you the book. However, if your DM has decided that they don't want it to be that simple, and they want you to narratively obtain a book in world, there's definitely nothing wrong with that.
You will have to work with your DM to obtain a book. There are no officially-sanctioned methods for this, so it's really up to you and your DM to work together to come up with something that you deem appropriate.
Buying it in a shop, however, would be one very good, simple method. Your DM seems to think that this would mean anyone could get the benefits of the feat without taking the feat, if I'm understanding the question correctly? However, I would suggest that in this case having the book is necessary but not sufficient to gaining the Ritual Caster benefits. Instead, imagine having the book is like having a violin. You then still need to learn the violin (take the Ritual Caster feat) to be able to make music (cast ritual spells).
There is precedence for this. In the late 4th-edition novel Brimstone Angels: Lesser Evil, a character goes around different shops looking to buy a ritual book for the purpose of casting rituals. She is later given a ritual book by another character, but is unable to make use of it until a character who is already familiar with how rituals work is able to teach her. To translate this in to 5e mechanics, she is given a ritual book, but does not take the Ritual Caster feat until a little later after she has been taught the rituals.