They're containers. Different codecs can be used for different containers.
For example, if you encode a video file, you could encode it with a 264 codec, x264 codec, or XviD codec.
However, that's the compression algorithm.
The encoded video needs to be put into a container so it can be parsed and played.
In the case of XviD or x264, it could go into an .avi, .mp4, .mkv container, or others.
TL;DR-- .flv and .mp4 are containers, not codecs. The video files can have the same codecs in different containers.