Is there any difference between 我给你不买 and 我不给你买? Is there any difference between these two sentences:

我给你不买

and

我不给你买?

Chinese grammar says we should put 不 in front of the preposition in these types of sentences...
But I saw a lot examples when 不 goes after the preposition construction and goes exactly in front of the verbs.
The same question regarding 没有, for example,

我在商店没有买很多东西

could we here say

我没有在商店买很多东西 or
我在日本没有住一个多月

etc.
First, 不 and 没有 are different, please read
What is the difference between 不 and 没?

The rule of 不 'in front of the preposition' doesn't always apply to 没有

As your examples indicated 

Both "我在商店没有买很多东西" and "我没有在商店买很多东西" are valid sentences

As for 我给你不买 vs, 我不给你买: 我给你不买 doesn't follow the rule of '不 in front of the preposition' and therefore , is invalid

You can say 我不买电脑给你 or 我不给你买电脑 (both mean "I don't buy computer for you") , but not 我给你不买电脑.