I have not had this problem until recently. I have a Breville Smart Grinder Pro and the built in grinder in the Barista Express. Both beans I had in there, when dosed to 18g, would not fit in the portafilter after tamping.
I've used a dozen different beans and they all tamped to a certain point on my tamper. These two beans now have the tamper sitting about 20-25% higher in the basket. And then I am getting insane flow and gushing out of the portafilter spout.
The problem with the grinds not fitting, is that a grind setting issue or?