means
to set out intending to gain an advantage or profit from someone else, but instead end up suffering a loss yourself. It warns that schemes to benefit at another's expense can easily backfire. The proverb describes someone who goes to shear another person's sheep for wool but returns having been shorn instead. It is commonly used when a person's plan fails and they end up worse off than before.
He who digs a pit for others falls into it. What goes around comes around. You reap what you sow. Hoist with one's own petard.