Ok, this is my first post ^.^ not sure if anyone posted this yet but here it goes:
If the limit is 5:
-Buy 5 from vendor
-Sell back 5 (They are now sitting in the buy back window)
-Buy 4 more
-Buy back the 5 from the buy back window
(You now have 9 potions instead of the 5 limit)
If the limit is 10:
-Buy 10 from the vendor
-Sell back 10
-Buy 9
-Buy back 10
(You now have 19 potions instead of the 10 limit)