"I buy manga in Ikebukuro."
に indicates a motion towards something, whereas で just tells us that the action takes place at that location (so it does not indicate motion towards it). There are some exceptions, such as ある , いる and 住む, which take に and not で. From a linguistics standpoint it might make sense to use に for these cases, but it's best to just consider these as irregular and just remember it.
This is really a big difficulty for foreigners (like me). Many verbs carry no hint of motion or only very limited motion, such as 立つ、読む、寝る、考える、困る… I think I can't finish the list. Sorry but personally I think considering them all as exceptions is not quite a helpful way. I have no better way than using gut feeling though.
As long as there is no risk of causing a big misunderstanding, I would excuse myself if I have chosen a wrong one.
に and で are tricky ones, sometimes, but there are a couple of differences that can make it easier!
1) に represents direction as well as location... and indirect objects, time, and other things too! It's a very busy particle. But when it comes to it and で, the difference is that one is about is direction:
店に行きます = I'm going to the store.
家に帰りました = I returned (to) home.
And the other (で) is about where you are when you're doing something:
図書館で本を読んでいます = I'm reading a book at the library.
その店で傘を買いました = I bought an umbrella at that store.
As KiritsuguZFC said, there are some verb exceptions where に is considered more appropriate, such as いる:
図書館にいます = I'm at the library.
But these are irregular and you'll easily be forgiven if you use で instead.
2) I find it helpful to think of で as "by way of," because it can also be used to describe a method of accomplishing things:
タクシーで店に行きました = I took a taxi to the store.
電話で話しました = We talked over the phone.
"By way of" catches both meanings, location of action and methodology, pretty well. Consider one of the previous sentences, this time using this trick:
その店で傘を買いました = By way of that shop, I bought an umbrella.
It's not the most grammatically correct translation (and Duolingo will certainly mark you wrong :P), but remembering it this way has helped me figure out the distinctions between で and に, especially during casual conversation. I hope it helps you, too!
A little bit shorter but not as thorough as Cici's explanation and how I remember is に is to and で is at.
And if I mix them up, well, hopefully the Japanese person will be kind enough to understand. Although even when you have perfect grammar and pronunciation they still might hit you with "sorry I don't speak English" so I guess don't worry too much about it.
Out of curiosity, is マンガの本 relatively common, or do people mostly just use マンガ? I would've expected the latter these days, but while Duolingo accepts both it seems to lean towards the longer version...