In spite of the favor that Jacob showed Joesph, there can be no justification for the action taken by Joesph's brothers. It was sin caused by ency. Instead of being grateful for Joesph who brought them food, they were overcome with jealousy and even thought of killing him (Gen 37:18-20).
The Apostle James says, "where you have envy and selfish ambition, there you find disorder and every eveil practice (Ja 3:16 - NIV)
Peter admonishes us to put away 'all malice and all deceit, hypocrisy, envy, and slander of every kind. (I Pe 2:1 - NIV).
The result will be tragic if we do not allow the Holy Spirit to remove these things from our lives!