The present invention relates to an aqueous polymer dispersion which is obtainable by free-radical polymerization of a monomer mixture which comprises at least one amide-group-containing compound, at least one crosslinker and at least one monomer with at least one cationogenic and/or cationic group. The invention further relates to the polymers obtainable by drying such a polymer dispersion, and to cosmetic or pharmaceutical compositions which comprise such a polymer dispersion or such a polymer.