This is not how I understand it. The expression (which is also used in Egypt with slight difference يشتري سمك في مَيّة) refers to someone buying something that's no in front of him and that is not guaranteed to come. It's like the reverse saying of "selling eggs/milk before getting to the market". So it's like making dangerous bets, or relying on things that are not certain.
Hopefully more opinions would confirm or correct my post.
It's interesting how the same idiom is used in different dialects with different words meaning the same thing! In Iraq they say يشتري سمك بالشط where shaTT in Iraqi Arabic is the whole river not just the riverside (من باب تسمية الكل باسم الجزء).
As for the meaning, I agree with Cherine, what is meant is buying the fish while it's still in the sea/river/body of water. It refers to depending on something that is not guaranteed and may or may not become a reality.
No, not exactly. Counting your chickens before they hatch is more like depending on something that you expect but hasn't happened yet. Whatever you expect has a better chance of happening than not. I mean, at least you own the eggs! Also, you know exactly what you are counting.
Think of it this way, you go to the market to buy some fish, the fishmonger says "pay me for the fish now, tomorrow I'll send the fishermen to go and fish and bring you the fish". You are buying something that the seller doesn't own, and even when he does acquire the fish, you have no control of what type of fish or what size you will get because that all depends on whatever the fishermen will be able to catch! It's not merely 'a chance of not happening', it's completely obscure and uncertain.