Gratuito is an adjective. A pipoca é gratuita. (The popcorn is free). Grátis is an adverb; is related to a verb. A pipoca vem grátis / vem de graça. (Literally: the popcorn comes for free). As gratuito is an adjective, it follows the gender and number of a word.
"Livre" is related to freedom (liberdade) "nobody is free" = "ninguém é livre" (you translated this way because you are not meaning price, but "the quality of having freedom")