What is the mechanism behind this?
From the NCERT textbook:
During peptization, the precipitate adsorbs one of the ions of the electrolyte on its surface. This causes the development of positive or negative charge on precipitates, which ultimately break up into smaller particles of the size of a colloid. Note that the presence of equal and similar charges on colloidal particles is largely responsible in providing stability to the colloidal solution, because the repulsive forces between similarly charged particles prevent them from coalescing or aggregating when they come closer to one another. Thus, they remain in dispersion medium as stable colloidal sols.
And why does having a common ion matter?
The sol particles acquire positive or negative charge by preferential adsorption of positive or negative ions. When two or more ions are present in the dispersion medium, preferential adsorption of the ion common to the colloidal particle usually takes place.