Here's the lowdown: Matt Dillon was in the federal marshal's service, assigned to the U.S. Marshal's Office in Dodge City. This sign hung on the front of his office building for the entire run of the series:
Technically he would have been a deputy U.S. marshal, as "marshal" was more of a regional political position- they rarely if ever actually took the field. Still, even now it's not uncommon for deputy marshals to be referred to as "federal marshals," in fictional media and in real life. Ever hear of Marshal Raylan Givens?
The United States Marshals Service is the oldest federal law enforcement agency in the U.S., formed in 1789. Their job is to serve and protect the judiciary branch (although they are actually part of the executive branch)- they protect judges and courtrooms, transport prisoners to and from court, protect witnesses, serve arrest warrants, and pursue fugitives. As agents of the federal government, marshals can pursue said fugitives anywhere in the United States- or other countries, if they have extradition papers.
A lot of famous deputy U.S. marshals were active, during the period of the "Old West," in and around present-day Oklahoma. That is because, until the 1890s, what we now call Oklahoma was Indian Territory. The eastern part of Indian Territory (or I.T.) was the location of the "Five Civilized Tribes" who had been transported from the East during the Trail of Tears. Those Nations had their own governments and their own police force -called lighthorsemen. The lighthorsemen had jurisdiction over Indians, but not over U.S. citizens.
As a result, many outlaws "headed for the Nations"... the local police there had no power over them. "Hanging" Judge Isaac Parker's court in Fort Smith, Arkansas (right across the I.T. border), however, did. Federal marshals attached to that court had the right to go into Indian Territory and apprehend them.
Among the most famous of those marshals were the "Three Guardsmen of Oklahoma," pictured below... l to r., Bill Tilghman, Heck Thomas, and Chris Madsen.
Another of the most effective marshals was Bass Reeves, who was only one of several African American -and in some cases African-Indian -federal officers operating out of Fort Smith.
Famous fictional agents of Parker's court included deputy marshal Jed Cooper from Hang 'Em High:
...And the incomparable Rooster Cogburn.
In the earlier seasons, it was made clear that Matt Dillon was employed by the War Department and had to answer to Washington... this was alluded to in the final seasons, but only rarely. One second-season episode, "Bureaucrat", had Matt's Washington superior come into Dodge to do an inspection.
This is why a common plot device was to have Matt out of town at Fort Hayes, testifying in court or transporting prisoners. It's also why he could wind up, in any given episode, pursuing the renegade Chato through Jicarilla Apache territory in New Mexico (in one of my favorite episodes):
...or even into Mexico to deal with a corrupt federale played by Gilbert Roland, in the two-parter "Extradition."
Since he was stationed in Dodge by the Marshals Service, the town council hired him to serve double duty as town marshal. Later, as the town grew, that required him to have a deputy or two, at least part-time- these deputies (Thad, Festus, and Newly) were referred to as Deputy U.S. Marshals, so it is possible that Matt deputized them in his federal capacity, which would have been within his purview. (Note- Chester occasionally accompanied Matt, but never wore a badge or was called a deputy. Officially, he was hired by Matt to help out around the office/jail, thus being an assistant rather than a sworn in lawman.)
It is worth noting, by the way, that the U.S. Marshals Service did not have uniform badges in the 19th century like they do today; instead, they were purchased by federal agents and often reflected their own tastes. Here is the modern day federal marshal's badge:
Anyhow, if you were ever confused about Marshal Dillon's status, them there's the "facts," near as I can tell.
Check out my other "Gunsmoke Journal" installments:
#1 Dodge City and Me
#3 Chester vs. Festus