So a workaround is to take a lot of photos with the focus plane at different depths. You sweep the focus plane through the scene, snapping a lot of photos as you go. This can be automatic with nice gear.
Then you take all of those photos and combined them digitally, with the algorithm selecting pixels from the photo with the best sharpness in that region. So the photo you see is a combination of many photos.