This passage follows the teaching of Jesus in the same pattern i.e. things we have heard from the law vs. his teaching, which reaches to the heart of the matter. This principle applies to 3 categories of our enemies and what it means to love them. Our goal is not to love our enemies for anything good in return. But it is with the realization that we need the same mercy from God as much as our enemies do.
“You have heard that it was said, ‘Love your neighbor and hate your enemy.’ But I tell you, love your enemies and pray for those who persecute you, that you may be children of your Father in heaven. He causes his sun to rise on the evil and the good, and sends rain on the righteous and the unrighteous. If you love those who love you, what reward will you get? Are not even the tax collectors doing that? And if you greet only your own people, what are you doing more than others? Do not even pagans do that? Be perfect, therefore, as your heavenly Father is perfect.”
Matthew 5:43-48 (NIV)