I agree with Toomai's answer, and would like to add my own, it's past the scope of the main game, though, so I'll tag it as a spoiler
After completing the main game, you unlock the Special worlds. Each of Special World 8's levels require increasing amounts of star coin to unlock. The last level requires 290 star coins to unlock, while the maximum amount of star coins available in the other levels is 285. meaning that even if you collected every star coin in every level before that, you'd still need to complete at least 5 purple challenge blocksmystery boxes to unlock it.