I dont understand this either... as i went from colombia via sao paulo 2 months ago, and have gone through soa paulo maybe 10 time on way to europe, and there was no passport check at all. The last time it was a layover of 4 hours, the only thing that was close to immigration was that we had to get our carry on bags scanned when we arrived, but after that i was in the transit area, i had to walk to another area (10 mins walk) for the new gate but not once did i come into contact with immigration, no one asked how long i was there for, where i was going to etc..
The only time my passport was checked was when i went to board the flight to BSAS at the boarding gate. So i am guessing you did something wrong and went through immigration. I did however read that if you stay longer than 7 hours in transit and you require a visa to enter the country (eg: US Passport holders) you need a visa. But i am not sure where they would check unless you leave the transit area..
As far as i know, in this part of the world the only place that does immigration checks of transit passengers is the USA, part of the reason i try never to travel via the USA, cant stand their immigration process, the attitude of the officers at the border and the length of time to go through - i have missed connecting flights because of this, even when i had over 2 hours to get from one plane to the other...