A fundamental link between system theory and statistical mechanics