Caged Ghost

Caged Ghosts are close relatives to Dangling Ghosts that grow from drainage grates in the floor. They are gelatinous ghosts commonly found in damp environments.

Super Mario World 2: Yoshi's Island / Yoshi's Island: Super Mario Advance 3
In Super Mario World 2: Yoshi's Island and Yoshi's Island: Super Mario Advance 3, Caged Ghosts are found mainly in Naval Piranha's Castle and Ultimate Castle Challenge. There are two different kinds of Caged Ghosts: the ones that are squeezed into sewer tunnels, and the large round mounds. They completely block Yoshi's path to the goal or other bonuses, and simply touching one will cause Yoshi to drop Baby Mario off his back. As their primary attack, Caged Ghosts spit an infinite amount of green Shy-Guys or Woozy Guys at Yoshi, which can be used to attack the Caged Ghost. Doing so will cause it to shrink/recede, until it is at its farthest point, when it produces no more enemies and Yoshi is able to pass it. However, Caged Ghosts are invincible and will slowly grow out again a while after being hit with an egg, regaining their ability to produce enemies.

Yoshi's New Island
Caged Ghosts return in Yoshi's New Island in the level King Clawdaddy's Sewer Castle, where they act and look just like in their original appearances.

Super Mario World 2: Yoshi's Island

 * Official Nintendo Player's Guide: Lurking in sewers, this tough guy eats Shy-Guys, then spits them out for your egg-making pleasure.