It's a good question with a complex answer. Biblically speaking, it cannot be said that God "hates the sin but loves the sinner."
We must remember, though, that God's hatred of sinners is not at all
capricious. His hatred isn't emotional. His hatred is His settled disposition against all things sinful and all sinful persons.
The only way that God can "love the sinner and hate the sin" is in dealing with Christians through the Cross of Christ. It is in the Cross that God demonstrates His love for His elect and His hatred of their sin.
Nevertheless, even towards the unbelieving people, He demonstrates some type of love as He provides for them through common grace. After all, "he makes his sun rise on the evil and on the good, and sends rain on the just and on the unjust." (Matthew 5:45 ESV)
Now, the reason that we (as once-condemned and now redeemed sinners) cannot hate sinners is that we are--fallen as we are--capricious (where God is not), and we have no right to hate an unbelieving person because we did not ultimately make ourselves believers. It's a case of "there, but for the grace of God go I."
Loving our enemies is not simply for the purposes of imitating God, per se. Rather, it's for the purposes of attracting them to the Gospel of Jesus Christ. We are called to love and pray for our enemies--in imitation of God--because that is what He did for us who are believers. As the scripture says, "God shows his love for us in that while we were still sinners, Christ died for us." (Romans 5:8 ESV)
Blessings,
The Archangel