reminds us that
a purchase or choice can involve uncertainty, and the person making it must accept the possibility of disappointment; the nonstandard grammar is part of the familiar saying.
Imagine a case where sometimes you must trust in luck when buying something; Something may not be as good as you expected it to be.; then “You pays your money and you takes your chances” fits well.