From the Super Mario Wiki
A Star Medal is an item found in Super Paper Mario. They can only be acquired by purchasing them at Howzit's shop at Flipside for fifty coins. When used, it gives the Player 1,000 Points, which is immediately added to their score (3,000 if the Speed Flower or Slow Flower is used).
Gold Medals are a stronger variety of the Star Medal, which add ten thousand Points to the Player's score, but cost five-hundred coins each.
Using these is beneficial as points serve as the player's EXP points in the game.