Can a person be mean towards another person if that person was treated poorly before?

I keep being mean to my best friend, and I don't know why all the time. I did come to maybe some kind of conclusion that it is because my mother is mean to me all the time. Could that be a cause?