Some AVI files are Motion JPEGs, which are simply a series of JPEG images that are strung together over an audio track. These pictures and audio are contained inside the .avi "container."
I sometimes forget and hold my Fuji F31fd point and shoot camera in portrait orientation when recording movies, which makes them appear rotated when viewed on a computer. I searched for a long time to find a free program that would rotate the Motion JPG .avi files without re-encoding, which is very lossy.
AVIdemux is a nice free program that appears to unpack your .avi container, rotate the JPEGs, and re-pack the container, all without re-encoding. It is nearly lossess. It is not totally lossless because, by nature, rotating .jpg pictures is a little bit lossy, but not noticeable if the pics are only rotated only once. Other programs I tried would introduce unacceptably nasty blocky artifacts into the rotated video. I'm sure that you will not notice the difference when using the method below.