Rates are negotiated between the railroad and the car owner. In most cases there is a charge for hauling the car in, a daily rate for storage (ballpark $1 to $3 a day) and a freight charge for the outbound move. But it's whatever the parties agree on - sometimes the freight charge is waived one way, sometimes there is a higher up-front charge which includes the move in and 30 days storage, sometimes the daily rate is much higher or lower, and in some cases other services may be involved besides just storage, such as re-lettering the car if it is sold, maintenance, inspection etc.
Cost of the storage is not the only factor in where cars are stored, location of the storage site can be important. If you have 100 surplus hopper cars in Oregon, you're probably not going to ship them to Pennsylvania for storage. If the cars are on CSX now, it may be cheaper to send them to a storage line served by CSX a bit farther away, than something closer served by NS (or vice versa). Involving a second railroad can add to the cost.