"Please put the bag here."
ここに indicates that ここ is the destination of the action. Kinda similar to how ここに行きます indicates that ここ is the destination that you're going to. I'm not sure how to properly explain ここで、but I imagine it's like if you're placing something on your desk in your room, for example. Maybe 部屋で机に置きました。But correct me if I'm wrong.
袋をここに置いてください not accepted. In fact, for a 3-year old question I can't understand why so few variants are accepted. Doesn't seem allow any word for "bag" other than かばん (tried 袋、バッグ、even 荷物), or anyway of saying "here" other than ここに (vs the more polite こちらに), nor does it allow using a topic particle.