When my wife attached one of her hand knit cuffs to a machine knit sock from House of Cheviot, she hand sews it on using the same yarn she knit the cuff with. She has a large needle she uses special for that purpose. I've never paid that close attention when she is doing it, but it doesn't seem to be anything magical.

The socks she uses have a finished top (i.e. they are not cut). But I have seen her cut other knit items she has made (these would be hand knit) and she machine stitches the edge where she is going to cut, to keep it from unraveling.

I'd be afraid that if you were to do this on a sock, though, the machine stitching would tend to remove some of the stretch from the sock, if not done properly. So if you try it, just make sure you are not permanently stitching your socks with a 6" opening at the calf!