1. He spent a lot of money on dancing.

2. He spent a lot of money in dancing.
3. He spent a lot of money on buying things at the shop.
4. He spent a lot of money in buying things at the shop.
5. He spent a lot of money dancing.
6. He spent a lot of money buying things at the shop.

(Which expressions are grammatical?)

2 and 4 are incorrect. The others are right.

Out of the given expressions, the grammatically correct sentences are:

1. He spent a lot of money on dancing.
3. He spent a lot of money on buying things at the shop.
5. He spent a lot of money dancing.
6. He spent a lot of money buying things at the shop.

These sentences correctly convey the message that someone spent a significant amount of money on dancing or buying things at the shop. The preposition "on" is used when referring to the activity of spending money on a specific item or activity. The preposition "in" is not typically used in this context. Therefore, sentences 2 and 4 are not grammatically correct.