> From what I understand, this is because larger objects have more mass, moving slower when shaked, so as the larger (brazil nuts) don't move as much relative to the smaller ones (peanuts), and because of gravity, there's a cavity left under the brazil nut which gets filled in with peanuts.

I always thought it was because the smaller nuts can fall into smaller spaces, while the larger nuts cannot.