Cheaply built guitars will do that sometimes if the necks aren't true. If that is the cause you will notice (probably) that capoing on the 2d fret does not distort the tuning, while capoing on the fifth or seventh frets does.
The remedy is a rebuild by a luthier.
Assuming that is the problem.
A