I'm Japanese. I hope to improve my English and use English more often, so I'll answer your question.
As Darius-san wrote, 2 is ambiguous, and most Japanese think that she arrived atin her country and then bought the bag. But if I translate these sentences without thinking well, I might do both to "I bought a bag when I went back to my country." Given this, I come to think that this English sentence is also ambiguous. When do you think the speaker bought a bag?
By the way, the sentence "国へ帰る時、かばんを買いました。でもやっぱり帰りませんでした" Darius-san wrote is pretty strange. Japanese never say so.
If you say this, it is correct.:
国に帰るためにかばんを買いました。でも、やっぱり帰りませんでした。 I bought a bag to return to my country. But it turns out that I never actually got home.
国に帰るためにかばんを買いました。でも、やっぱり帰りませんでした。
I bought a bag to return to my country. But it turns out that I never actually got home.
Your first sentence necessarily implyimplies that she got home.
My English may prevent you from understanding. Sorry.