From the Super Mario Wiki
Purple Mice are ghosts that are found in Luigi's Mansion. As their name suggests, they are purple mice, and like their blue cousins, they serve as obstacles for Luigi. However, unlike their blue counterparts, Purple Mice can also run up the walls and across the ceiling. This allows them to slam the doors shut on Luigi, causing him to take damage. If they hit Luigi, they reduce five points of health, like Blue Mice.