You put your code on SO with the intention of giving it to someone else, potentially many others. That's the entire point in SO and it's pretty clear from the start that that's what you're doing there.
You put your photos on Instagram so you can show them to your friends. Instagram is a storage space for your photos. When someone looks at your photo, the intention is that you're showing them the photo, rather than giving them the photo. (Un)Fortunately, when computers are concerned, showing and giving are the same thing.
The fact that people think of showing and giving as different, but their smart devices treat them the same, results in a lot of friction. The entire DRM industry and respective legislation is concerned with aligning computer behaviour with (some) human expectations.
So yes, I agree that Instagram works the same as Stack Overflow, but that's not what people's instinctive expectation is.