The ones getting off the boat with little interference were all legal immigrants. The bottleneck was getting on the boat to begin with, and that struggle didn't happen on Ellis Island, it happened back in their own country. They needed a visa. Once they were on the boat and they arrived at Ellis Island or at another port, there were tests they had to undergo--medical, intelligence, and an examination of their papers--and then they could enter the country, if they passed all the tests. This situation lasted only until 1882. In that year, they passed the Chinese exclusion act, forbidding Chinese people from immigrating. In 1907 they passed a law controlling Japanese immigration. As larger numbers of foreigners came, laws became more restrictive. Immigration acts in 1917, 1921, and 1924, each more restrictive than the last and based upon eugenicists texts (eugenics was popular at that time) ultimately prevented Asians and Africans from immigrating, and restricted or prevented southern Europeans, Eastern Europeans, and Jews who were fleeing persecution in Europe, from immigrating. There were no restrictions on immigration from Mexico, central, and South America.
So basically, the reason why it might have seemed like early immigrants were just getting off a boat with little interference was that that was what happened prior to World War I, on the East Coast. On the West Coast, restrictions were huge against Asians by then and you can read more in Ron Takaki's Strangers from a Different Shore. Midway through World War I, restrictions became severe against other groups (except Westerns Europeans like Brits, Scots, the Irish, French, northern Europeans, and later, Germans). They just got even stricter after that, but the struggles occurred at the US embassy in each country, with incredibly long lines, and attempts to get visas in various ways, at those embassies. People would do things like go to Canada, then go from Canada to the US for "the day", but never return. Or get fake papers claiming they were from a place they were not--a place where the quota for immigrants had not yet been filled. Sometimes quotas weren't filled deliberately. During the 1930s and throughout World War II, Jews were desperate to get out of Europe, but the quota for visas for Jews almost never was more than 25% filled, and most people were turned away.
My answer will relate to American immigration and I assume that is what your question relates to: Some of the earliest American immigration laws appeared in the 1790s and required citizens to live 2 years in the country to obtain legal status. Since then, there have been numerous acts regarding immigration in America. Some of the most controversial have been the Page Act of 1875 (Banned Chinese) and the Emergency Quota Act of 1921(limited the number of immigrants to 3% of a country's population in America). On a personal note, my great grandfather was deported under the Emergency Quota Act of 1921. But throughout American history there have been dozens of laws placed to restrict immigration. Usually they were written to restrict a certain national or ethnic group (and during the cold war to restrict political affiliations such as communists and anarchists).