Like an HSA, Medicare is designed to provide for healthcare expenses for the living. As such, you cannot use it for funeral expenses.