When you sit down with a rifle in your hand and you stand up again (not by walking, but by making the "Stand Up" animation), your character will put the weapon away as soon as you stop walking.
This seems to happen unfrequently, but is reproducible.
Tried with:
Mosin, Revolver
Does not happen with:
Melee Weapons (tried with Crowbar and Pitchfork)