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).