Clothing intersecting with skin
It seems like identical weights would be right-- but unfortunately, they're not, because how a bone deforms a mesh isn't just a function of the weights, but of the distance from the bone to each vertex as well.  And your sock is more distant from the bone than your leg.  That requires weights that are more diffuse the more distant the mesh is.
There are a couple of ways to get those more diffuse weights.  If you weighted your leg via autoweights, the slightly more diffuse weights you want can also be gotten via autoweights, just via autoweights on a slightly larger model.  Duplicate your model, alt s shrink/fatten until it's about the same size as your sock, and then reparent it to your mesh with autoweights.  Take a second to compare weights-- notice how the bigger mesh has different weights than the smaller mesh?  Weights that are smoother, more spread out.  You can use this mesh as the target of a data transfer for your sock to transfer the more diffuse weights onto the sock.
If you weren't using autoweights, you can use a smooth operation in weight paint mode to make your sock's existing weights more diffuse.  Set it to affect all groups and give it a positive expand/contract value, then tune the other parameters to eye.
However, the truth is that you're best off hiding mesh rather than fiddling too hard with weights.  That's especially true when you're talking about a game engine, where you probably have a limited number of weights per vertex.  In that case, think about breaking your sock (and leg) into multiple pieces: those that might be hidden by pants, and those that won't be hidden by pants.  It's still modular, it just requires fiddling with a few more parts and combinations.  Or, consider giving the meshes shapekeys that shrink parts of the mesh, to be used only in certain combinations of clothing.
In Blender, there are other techniques you can use as well, like post-armature displacement or shrinkwrap.