To the economical aspects I cannot say much as it's not my professional field of interest, but I think for the second part that coffee became just more available after the industrial revolution (as most of the other goods did as well) due to more efficient production methods. Furthermore I guess that there was a transition in which the diffeference between private life and work life was much more pronounced after the industrialisation - before people worked more or less where they lived, but after you had official working hours when you had to be in the factory, office, etc...
This doesn't fit most of the peoples' natural sleep-wake rythm. Hence they needed something to stimulate them at late hours or in the morning, but which must not interfere with their working ability - here coffee or strong tea do a very good job.
Marcelo, I cannot say anything of use relating to your new question about psychoanalysis. But your question about coffee does have a quite fascinating sidelight, about which I can perhaps add something useful. There is a splendid book by Daniel Lord Smail, 'On Deep History and the Brain' (It has been influential - various spin off publications are listed on Google) Smail discusses the evolution of the human brain from the distant pre-literate past to the present and the role played by 'autotropic' substances (stimulant drugs) and pursuits (dance, music, books)in shaping the human brain (or 'mind' if you will). As Smail puts it: 'Humans have invented a dizzying array of practices that stimulate the production and circulation of our own chemical messengers'. Coffee and the culture of coffee (and similar stimulants) in western civilization plays a very large role in Smail's history of the recent evolution of the brain. If you have not encountered the book already, I recommend it without reservation. Available on Kindle and also in a very lively audio version, engagingly read by Smail.
There is a lot of related work in this area. As I refreshed my memory, via Google, I came across an intriguing title of a conference at the Max Planck Institute, 'Criminal Law and Emotions in European Legal Cultures...etc' (May 2015) in which Daniel Lord Smail is to participate by way of 'Reflections'.