The reason your stuff is returned to you is because the server probably didn't save. I know in my base code that I posed, there was no server-side save for when you sold an item .. although there should be
I've been working on some code that reads the shopkeeper data into an array, kinda like npc data and item data does currently.. although I"m thinking it *should* read off the fly, since we should save memory for quest info (when implemented).. of course the other thing is this crap should only be loaded once, instead of for each instance of the zone server.
But I havn't had a whole lot of time to work on new stuff, my primary focus is figuring out the structs and opCodes for a few other things .. like when you view an item a merchant is selling, and it closes the merchant window - and a few other mystery things.

I might have a new code post in a few days with some better functionality with the merchants.. although I woulnd't doubt if someone else is working on it too.