Probably depends somewhat what scale you are in. For instance, I was into N-scale for a couple of decades, and have amassed enough N-scale to stock a small hobby shop (or so it seems). Since N-scale takes up so little room, I have virtually all the boxes/cases/containers that they all came in. And most of my collection is now back in their boxes, as I have been focusing on O-gauge for the past 10 years or so.
As my collection of O-gauge started increasing, I started noticing that empty boxes were taking up an inordinate amount of room. After perusing the internet to see what other O-gaugers were doing, I adopted a method that a fair percentage of them reported doing.
I keep all locomotive, passenger car, and caboose boxes. Virtually everything else, which is freight car boxes, I toss in the trash. I have far more freight cars than anything else. So it's more of a pain in the arse to try and store all of those empty boxes as opposed to pitching them.
Another reason for pitching all my O-gauge freight car boxes was the fact I've purchased a lot of my freight cars used (and some older ones not used at all!) for really good prices, both on-line and at train shows. Some didn't come in boxes, but a lot did. If I ever go to sell my freight cars, I'm confident I should easily get my money back out of them, even without a box to put them in!
To store all my off-layout rolling stock, I use Banker's Boxes and clear plastic storage containers. I do label the Banker's Boxes as to what type of freight cars are in them (Mainly O27 Size, Traditional Size, 1/48 Scale, etc. etc.), but not necessarily a list of every single car in them. By using a horizontal cardboard divider plate, I can easily get 10 cars in each Banker Box. 5 cars in the bottom, and then a divider plate followed with 5 more cars on top. Then I can stack the Banker's Boxes and plastic storage containers on wooden furniture dollies obtained from Harbor Freight Tools. I can roll these stacks under my layouts for storage. Maybe not 100% perfect, but works good enough for now.