Like all Tupac's other songs, "Dear Mama" is set in the streets of New York, Baltimore, and Marin City, a life in the shadow of wealth and privilege with no visible way out.
Tupac grew up on the streets of New York, and as a young teen his mother moved him to Baltimore.
Tupac said, "Baltimore has the highest rate of teenage pregnancy, the highest rate of AIDS within the black community, the highest rate of teens killing teens, the highest rate of teenage suicide, and the highest rate of blacks killing blacks. [...] So as soon as I got there—being the person that I am—I said 'No, no. I'm changing this.'" (Source)
Pac started an AIDS prevention campaign and attended a school for the arts, where he started acting and rapping. But before he had a chance to finish his studies, the family moved again, this time to Marin City, California. The move was ostensibly an attempt to escape the violence and horror of Baltimore's streets.
By the time he and his mother made that final move, Tupac was living on his own, crashing with family friends and then living in an abandoned building with other street kids. He dropped out of high school at 17, and, through a series of breaks, got a record deal and a possible way out.
But as his songs indicated, Tupac never left the street life. His friends, or fellow "outlaws," another term Pac tried to elevate and reclaim, were still pimps, dealers, and actual gangsters. "Dear Mama," though it is wracked with hurt over the lifestyle he came up in, celebrates the contradictions of staying "in the life," as seen in the track's lyrics:
And even as a crack fiend, Mama
You always was a Black queen, Mama
With his newfound success, Tupac had cars, hotel rooms, record deals, and a nice house. But according to his friends, he filled his first house in Oakland with street kids and people in the community who were in need. He never thought about using his fame to "get away."
This may have ultimately been what killed him, but it's also part of what made him a martyr when he died. He was the success story who kept his heart in the ghetto.