In code-sharing, one airline purchases seats on the other airline's aircraft and resells them with its own flight number. Each airline is free to price their seats as they see fit, based on supply and demand. In your case, apparently UA feels they can sell the seat at a higher fare while Varig feels they need to lower their fare in order to sell the seat.
Or UA may want to use its seats on the Varig flight for connecting passengers from other cities where the fare is higher and so it prices your ticket higher to match the higher fares it thinks it can get from other cities.