DVD video is encoded as MPEG-2, which has a worse compression ratio than H.264. That is why the file size is smaller. During playback, H.264 is decoded and decompressed (i.e. turned back into full video frames) so you can watch it.
There should be no loss in pixel resolution, however converting MPEG-2 to H.264 is a lossy conversion. If you don't want any data loss, you cannot perform any format conversion.