Buried interconnects in the substrate or in the lid