From the Super Mario Wiki
Coin Bandits are pink colored enemies that appear in Super Mario World 2: Yoshi's Island. Their name comes from the Red Coin that they sport above their heads. These enemies run away from Yoshi on sight, but if Yoshi gets the coin from them, their behavior then reverts to that of normal Bandits. There is a glitch that if Yoshi grabs the coin without touching the Coin Bandit, it will act as if it was still holding the coin.
Coin Bandits return in Yoshi's New Island and act the same as they did in the original game. They only appear in the level Bandit Valley. In this game, they are red rather than pink.