Professor Hagrid hid golden eggs for the students and their nifflers to find in the Fantastic Beasts and Where to Find Them movie.
This was part of a lesson on magical creatures, and Hagrid wanted to teach the students about nifflers' love for shiny things.