It is already being done. Dealing with old piles of trash is somewhat dangerous (all sorts of volatile gasses build up there) but once you get around this you can burn the thrash (releasing quite a bit of energy) and go through the ashes later. The ash can be used for various purposes, such as construction, but needs to be sorted by grain size first. While going through the ashes you do indeed encounter precious metals. I recently read about a company that performs this sorting as a service. They are not paid for the work directly, but get to keep the gold (and possibly other metals?) they find. Apparently you can expect to find a gram or two of gold in a tonne of ash.