She spends a lot of time to shop. She spends a lot of time shopping.
Are both of these sentences grammatically correct and do they have the same meaning?
As a crude rule of thumb, if you:
... then you spend it before you get or achieve the second thing. Here are some examples:
In these instances, the infinitives are infinitives of purpose. In other words the infinitive tells us the goal of the spending activity.
In contrast if you:
... then you spend it as you are doing it. In other words the spending something and the doing something are happening at the same time:
Notice that in these instances, the -ing-clause tells us how we spent something, not necessarily why we wanted to spend it. Consider the following examples:
Here we did not spend the time with the goal of not making progress or with the goal of being chased.
Gerund participle forms of verbs often indicate simultaneity, in other words they show that two actions are happening at the same time:
The Original Poster's Question
*We spent a lot of time to shop.
We spent a lot of time shopping.
The Original Poster needs to use the second sentence here. The reason is that the spending time happened concurrently with the shopping. The two activities happened together.
I agree with Ann O'Rack at WordReference:
It doesn't sound idiomatic to say "I spent 10 minutes to eat my meal"[–] it's definitely "I spent 10 minutes eating my meal".
Even the 'in order to' (ie 'in preparing for') reading doesn't sound idiomatic to me. This would correspond to an unaugmented 'I spent 10 minutes.'.
These Google Ngrams where 'spend some time shopping' manifests but 'spend some time to shop' doesn't, seem to indicate that my gut reaction is in agreement with many other people's.
They are both grammatically correct, but the first construction is not common in AmE. It would probably be interpreted the same as the "shopping" (second example).
A tiny fraction of readers might interpret it as "a long time [getting ready] to shop." that is, a long time until she started shpping. Or they might figure that "to shop" includes traveling forth and back, whereas "shopping" includes only time spent in a store.
Compare "you took a long time to get here", which doesn't differentiate between time spent before and during actual travel.
You might set aside a lot of time to shop for a hard-to-find item, and then you could spend a lot of time shopping for it.
But when transactional verbs like "spend" are followed by an infinitive phrase, the infinitive will typically have the meaning of "get" or "acquire". You don't spend to shop, you spend to get or to have.
I spent a lot of money to get these tickets.
I spent a lot of effort to get her to agree.
I spent a lot to have that car fixed.
I spent a lot of money to shop for that gift. (ungrammatical)