It complicates transportation to sell all goods in bulk. I'm glad that stores don't charge an extra 1.5 cents for the plastic bag around every gallon of milk and pound of rice.
You, yourself, might have enough responsibility and self-control to prioritize cleaning your containers, but this is not true for all humans. The store would lose business if their competitor sold milk already in bags or boxes, but you had to bring your own milk bag to their store. And someone's bags might have bacterial or other contaminants and get them sick, then they blame the store and get the health department to shut them down. (Tangent: Why is most milk still sold in boxes, and not in plastic?)
Glass is fragile, metals cause unexpected chemical reactions, wood is permeable & requires additional materials (wax, glue) to seal properly, and cardboard has poor durability.