This is the 2214th most frequent Spanish word.
gratis
Free; without cost.
Here, 'gratis' is used as an adjective to describe the service being provided at no cost.
Este servicio es completamente gratis.
This service is completely free.
Here, 'gratis' is used as an adjective modifying 'muestras' (samples) to indicate that they are provided without payment.
Ellos ofrecieron las muestras gratis.
They offered the free samples.
In this context, 'gratis' functions as an adverb describing how one can obtain the book ('for free')