why some books do not have a source or a reference at the end of the book, but there are many other books that have a reference in the text and at the end of the book, before the index، list of the reference is mentioned.
In academia, you will find two kinds of textbooks:
-introduction textbooks, especially those for undergraduates. These often do not involve references, but they are also not meant to be used as primary references. Citing the Ashcroft/Mermin for some solid-state physics statement is basically as good as not citing anything, especially since page-fine citation as done by humanities isn't done in physics.
-thematically more specific textbooks and monographies for graduate students and beyond. These commonly include references and, especially in the humanities and social sciences, may be considered primary sources. In the natural sciences it is more common to cite journal articles as primary references, books are usually compilations of other sources.