No shit, Sherlock, MKV and AVI are just containers after all. But if you have two versions of the same thing with the same filesizes, the MKV will be in 99% of the cases be better quality due to the facts that:
1. MKV supports H.264 video natively, AVI doesn't, thus MKV release is more likely to use H.264, which offers superior compression/quality ratio compared to XviD/DivX, which was most likely used for the AVI version.
2. MKV supports softsubs natively, softsubs in AVI is just a horrible hack (just like pretty much anything else in AVI), thus the AVI is most likely hardsubbed, which degrades quality.
3. MKV supports a shitload of audio formats natively, like Vorbis AAC, FLAC, WavPack, etc. Surprisingly AVI doesn't. With AVI releases, you're most likely going to have MP3 audio, which offers lower quality/compression ratio compared to most of the audio codecs MKV supports natively.
4. If the AVI is supposed to play in a DivX DVD Player, it must be hardsubbed with DivX/XviD video with MP3 audio, while the MKV is most likely softsubbed, uses H.264 and Vorbis/AAC audio.
To have the same quality with hardsubbed XviD/DivX than with softsubbed H.264 video, you'd have to use a fuckload higher bitrates and thus have a shitload larger files. So only you find a hardsubbed XviD/DivX AVI versions where the filesizes are twice the size of the MKV versions, the quality might be on the same level.