Throughout the 19th century, news reports and medical journal articles almost always use the plant's formal name, cannabis. Numerous accounts say that "marijuana" came into popular usage in the U.S. in the early 20th century because anti-cannabis factions wanted to underscore the drug's "Mexican-ness." It was meant to play off of anti-immigrant sentiments.
When cocaine usage first exploded, it was almost entirely in "laborers, youths, black people, and the urban underworld". Most of the early history of its usage is associated with non-whites and lower class peoples. Making it illegal worked for a long time until the cocaine boom happened and then it became popular with disco and rock, but again, still mostly used by non-whites. It wasn't until crack became a thing that the racial divide became more clear - rich whites got the clean cocaine, everyone else got addicted to crack.