Why some masculine nouns, like кофе, are treated as neuter?
It is unclear why the word that looks like a neuter noun and initially in 1700s was used as a neuter noun, later became a masculine noun.
For a long time grammar rules required "кофе" to be treated as a masculine noun. Recently, in 2009, grammar rules were officially relaxed (the link is in Russian). You can either treat it as a masculine, or as a neuter noun. Now phrases "черное кофе" / black coffee and "горячее кофе" / hot coffee are considered to be grammatically correct.