As humans we are more comfortable fitting in or following. When you go to a coffee shop or a crowded store, you're buying something because you actually see others buying it. The decision-making aspect is "taken away" from you, as it was already done by people at large. There is also the element of human interaction with the barista. It's much easier to spend $4 this way.
Yes, at the coffee shop you also might have an immediate purpose -- like chat with a friend. But even when I am alone, spending $4 doesn't seem like a big investment. It feels and seems normal. And note that this doesn't have to do with the quality of the product.
In the meantime, when you're at alone and are browsing an app store, the burden of decision making is on you. In essence, the thought process is "am I making a good decision? is it normal to buy something like this? do I really need this?" With that, $1 can seem like quite a bit when you have time and solitude to decide.