It's a bit of a mess. From Report from the Commission to the European Parliament and the Council on the operation of the provisions on stamping of the travel documents of third-country nationals in accordance with Articles 10 and 11 of Regulation (EC) No 562/2006 establishing a Community Code on the rules governing the movement of persons across borders (Schengen Borders Code):
The encountered difficulties, as described by the Member States, are
of the following nature:...Questioning of the necessity of stamping
the travel documents of third-country nationals who are in possession
of a valid residence permit issued by a Schengen Member State.
The report points out that it's a little silly to put entry/exit stamps in an EU resident's passport, given that there's no real way for them to check whether the person's overstayed in an EU country other than the one they're a resident of. It concludes in part:
The Commission underlines that travel documents of third-country
nationals who are in possession of a valid residence permit of a
Schengen Member State are exempted from the stamping obligation on
entry and exit.
Of course, none of that would have come up in the first place if everyone was strictly observing the same procedures, and the stakes are pretty low. If you're running out of room in your passport you could try yelling at the ICO if/when he picks up the stamp, but otherwise I wouldn't worry.