A horse's age can be assessed by looking at the state of its teeth. Accordingly, it would be bad manners to look into a horse's mouth if it had been given to you.
The question title did say 'gift horse' and, of course, one meaning of 'gifted' is simply 'given'...ie as a gift. "His lottery win was gifted to a local charity", for example.
I'm sure the use of 'gifted' was unintentional above but it certainly wasn't wrong.
Maria Bear obviously means"Never look a gift horse in the mouth."
It means accept other people's generosity and never question good fortune too closely.