It is a feature (primarily so arrows, potions, grenades, crafting materials, etc go into the appropriate container if they are already sorted there). However, things should not be stacked into locked containers (so that's a bug), and if gold is not excluded, the UI and trade mechanism should be checking within containers (on the list of suggestions).
I should mention that I can't absolutely be 100% sure it was the locked chest that ate my gold: my memory is generally not the most reliable thing, but I mentioned it as it definitely went into a container I'd collected early in the game that had a small amount of random gold and that's the only one I recall lugging about with me.