I got it working in the end by using a hint I found.
The trick is to make playlists per rating. One for 1 star, one for 2 star items, etc.
Drag all 1 star items into the 1 star playlist. Same for 2-5 stars.
Export the playlist/library (this results in an XML file).
Import the XML file on the other computer.
Go to each of the playlists, select everything, right click and give them all the correct rating.
(In case you have a backup .xml file that you want to use to restore ratings to your existing itunes installation: look at my description plus script where I use the exactly same trick, only with a script based on an old .xml file with the correct ratings)
Couple of improvements on this great simple solution (the best kind):
1) The exported XML contains the exact file location for each song. Therefore each computer must also have the files in those same locations. You can, of course, edit the XML accordingly if they are different.
2) You can use 5 smart playlists (one for each number of stars: 1-5) and they'll be auto-populated (no manual selection and dragging required).