Gears
Yes, it has to do with stowing gears on retraction.
The bogies are kept at a constant angle relative to the gear legs by an hydraulic actuator. Only by putting the aircraft wheels on the ground, the bogie angle is forced to change.
The geometry that is needed on retraction is determined by the attitude of the gear legs in extended position, compared to the retracted position. If you look at gear legs, you will see that some are almost at right angles to the longitudinal axis, some are slanted quite a bit aft; on retraction the pivot axis may or may not be parallel to the longitudinal axis. The retraction geometry depends on where the gear support point has to be for proper balance, and where the gear has to be in retracted state, depending on space available.
Most of the times, the most efficient packing will be with the bogie beam parallel to the longitudinal axis.