The questions ask the same thing, and the answer will be the same for both. In that sense, their meanings are identical.
However, language does not merely express meaning. That is *one* of its purposes, but not the only one. Language also conveys the way a speaker *thinks* about what he says. "Any" works like a number, except that the number is unspecified. So, while "seven apples" denotes a specified number of apples, "any apples" denotes an unspecified number of apples. Thus "Did you buy any apples?" means the same as
"Did you buy some unspecified number of apples?"
By putting "any" into the sentence, the speaker shows that he is *thinking* about the number of apples, possibly wondering what that number might be, or even if it is greater than zero.