This old phrase is often attributed to the book of Proverbs. It has fallen out of fashion in recent years due to the increasingly negative view of corporal punishment in the western world. But if you generalize it beyond the meaning of corporal punishment, there's something interesting to note.
It really implies that the wise party should never yield control to the unwise. And not even because of the adverse effects on the wise, but because such yielding does NO favors for the unwise either. Power in the hands of the foolish does not aid the foolish in any way that matters.