The relationships between Baba and Ali and Amir and Hassan had similarities and differences. The similarities were a result of social separation, but the difference stemmed from the different personalities of Baba and Amir.
In both cases, the relationship was affected by social status and ethnic differences. Baba and Amir were Pashtin, essentially of Persian descent, while Ali and Hassan were Hazara, people of Mongolian descent. Clearly, those of Persian descent held a higher social status in Afghanistan. In spite of the fact that Baba and Ali had grown up together, Baba was the master of his household and Ali was his servant. This relationship carried on to the next generation, in which Amir and Hassan grew up together but Hassan was a servant, too. You will notice from reading the story that Ali and Hassan live in servants' quarters and that Hassan does not go to school. There is no opportunity for him in Afghanistan, because of his ethnic and social status, so education would have been considered a "waste."
In spite of these social differences, Baba is faithful to Ali, even to the point of wanting to keep him on after believing Hassan has stolen from the household. He is a friend for life to Ali. On the other hand, Amir allows Hassan to make sacrifices for him, terrible sacrifices, but never speaks up for him. He not only allows his father to make Ali and Hassan leave, but also he manipulates events so they must leave. This "plot" is the result of Amir's guilt for not having defended Hassan to begin with. Hassan remains faithful to Amir, though, to the end.