To understand preference ranking we must first define preferences and utility functions.
Let >= mean "greater than or equal" and AP mean "at least as preferred."
Let > mean "greater than," and P mean "strictly preferred."
A utility function represents an agents preferences if
u(x) >= u(y) if and only if x AP y.
A u(x)>u(y) IFF xPy.
That is a preference ranking.
That is also where you are getting confused. The actor cannot purchase the outcome of lottery x or lottery y so their preference cannot be about x or y, which is the outcome.
What the buyer is purchasing is the outcome given a probability and a price to purchase. They can only purchase the gamble for x or the gamble for y.
Using the ~ to mean indifferent, a~b implies u(a(x,p1,t1))=u(b(y,p2,t2)), where a,b are gambles which are a function of the payoffs x,y; the probabilities p1,p2 and the terms t1,t2. This does not imply the lotteries are equal in terms or conditions. One lottery could by a high risk and high payoff gamble, while another lottery could be a low risk and low payoff gamble. If the utility of the two lotteries are equal then the preference structure of the gambler is such that they are indifferent to either lottery.
The item being judged is the entire package of probability, payoffs and terms (such as a time delay as in an option contract).