symbolic meaning
One reason I love this movie is how I see its psychological symbolism and archetypes. If you're not interested in that kind of exploration, just skip this post.
Joe is a person who is a combination of good and bad impulses, who has been mis-formed by his dysfunctional upbringing to have trouble forming mature relationships with women, and thus sees nothing wrong with using them for his own advancement.
He makes a decision to go over to his "dark side" but he doesn't see that as wicked, just an easy way to make money.
He goes to NYC, a place that is seen to be filled with dark characters (we see very few normal, wholesome people in New York in this film) and links up with Ratso/Rico, who represents the personification of all that is "dark" in him. The more closely he relates to Ratso, the more he sinks into degradation.
Ratso dreams of getting to Miami, but only to continue his rackets of cheating and exploiting.
As Ratso begins to sicken and weaken, things improve for Joe, he falls in with a fairly nice rich lady and potentially his dream is coming true.
He makes a final desperate violent attempt to keep Ratso alive, but Ratso's influence is passing away.
As they journey out of New York, heading through clear blue skies, clean surroundings, and sunshine, Joe sheds his dark identity, and the soiled garments of Ratso. He meets a wholesome, nice waitress in the diner (unlike anyone seen in NY). Having transformed his identity with the new clothes, he informs Ratso he is going to get a real job. His good self has won out. So Ratso, unable to sustain his existence, dies.