As always with any question that focuses on specific quotations, it is incredibly important to focus on the context of the quote, or what comes both before and after it to help understand the meaning of the specific quote you have extracted from the text. If we have a look at the quote you refer to in this brilliant poem, we can see that this famous line is actually part of a stanza that comes towards the very end of the poem, and is used to sum up the moral of the story:
He prayeth best, who loveth best
All things both great and small;
For the dear God who loveth us,
He made and loveth all.
The moral of the story therefore relates to the way in which having a right relationship with God, measured by our ability to pray, is related to our ability to love all of God's created order that surrounds us rather than just man. To have a right relationship with God, this stanza suggests, it is necessary to realise that God made and loves everything in this world, not just humans.