It is slightly different, depending on whether it is all one ticket, or two separate ones. The bags might be through checked if all on one ticket, but regardless you need to "enter" the US at Miami, so immigration is done there. If two tickets you may or may not have to collect the bags and recheck them in the departures area as that would be a new flight.