
In the second sentence, they consumed pie just in the afternoon, rather than other times of day.
For example, "They only ate pie in the afternoon," has a different meaning than, "They ate pie only in the afternoon." In the first sentence, they didn't eat anything else but pie in the afternoon.
"Only" can move around in the sentence depending on what you want it to modify. For instance, "afterwards" often comes at the beginning of the sentence because it connects it to the previous sentence: "We played games all afternoon. Adverbs that modify manner, place, or frequency can sometimes be found at the end of the sentence. Adverbs that connect sentences to other sentences are found at the beginning of sentences, such as "however." Adverbs that modify certain parts of the sentence often go in the middle, such as "only," which can change the meaning of the sentence if moved.