If you pick them from a crop garden, they'll go in a bag specialized for crops, but not if you pick them from an herb garden. Alternatively, if you try Magic Sort, any pumpkins you put in the bag from herb gardens will not go into the bag.
Not sure if this is a bug, or intentional, but thought I'd bring it up.