It depends on the nature of the codeshare agreement.
With most codeshare agreements, like the ones that would be in place on the MEL-SIN route, the marketing airline basically just takes a commission on each sale (e.g. could be in the vicinity of 5-10%) and the rest of the money from each sale...