It’s considered rude to examine a gift for value, and the expression “Never look a gift horse in the mouth” means just that.
The proverb has been traced to St. Jerome, who in 400 AD wrote a letter advising a disgruntled recipient of a gift of a horse to accept it in the spirit given without looking for flaws.
It was then, and is still, common practice to look into a newly acquired horse’s mouth, where you can tell its age by the condition of its teeth.