If you browse your Safari cookies by looking in the Safari preference pane, you'll notice that the cookies seem to in alphabetical order, sorta. It didn't dawn on me until I really looked closely at it -- the domains are sorted alphabetically based on their reverse domain name. So given the following domains:

macosxhints.com

apple.com

php.net

whitehouse.gov

www.apple.com

mozilla.org

they would be sorted in the following order (shown in reverse notation to better explain the sort order logic):

com.apple

com.apple.www

com.macosxhints

gov.whitehouse

net.php

org.mozilla

This reverse notation may seem unfamiliar for anyone not having worked with Java packages, OS X preference files, or one of a host of other places it is used. While it may seem rather unintuitive, it allows "apple.com" and "www.apple.com" to be displayed together in the sorted list. And you wouldn't necessarily want to display them in reverse notation, as that could be equally confusing for users. (For sake of comparison, Firefox sorts cookies based on their normal notation.)