Immigration (European Economic Area) Regulations 2016

The Immigration (European Economic Area) Regulations 2016, or EEA Regulations 2016 for short, constituted the law that implemented the right of free movement of European Economic Area (EEA) nationals and their family members in the United Kingdom. The regulations were repealed by the Immigration and Social Security Co-ordination (EU Withdrawal) Act 2020 on 31 December 2020, at the end of the transition period.
The regulations stand as amended by the following statutory instruments: SI 2017/1, SI 2017/1242, SI 2018/801, SI 2019/468, SI 2019/1155.
The Regulations were based on Directive 2004/38/EC. This allowed EEA citizens and their family members to live and work in the UK without explicit permission, and British citizens to work elsewhere in the EEA. Family members may have needed a special entry clearance (the EEA family permit) to enter the UK. 
The Regulations replaced the Immigration (European Economic Area) Regulations 2006 apart from Articles 7A and 7B which are saved from the 2006 regulations.
Legal context.
EU free movement rights come originally from the Treaty establishing the European Community, in particular:Article 18 (6)
1. Every citizen of the Union shall have the right to move and reside freely within the territory of the Member States, subject to the limitations and conditions laid down in this Treaty and by the measures adopted to give it effect.
2. If action by the Community should prove necessary to attain this objective and this Treaty has not provided the necessary powers, the Council may adopt provisions with a view to facilitating the exercise of the rights referred to in paragraph 1. The Council shall act in accordance with the procedure referred to in Article 251.
3. Paragraph 2 shall not apply to provisions on passports, identity cards, residence permits or any other such document or to provisions on social security or social protection.
Further clarifications as to the meaning of Article 18 TEC amongst others were introduced by Directive 2004/38/EC. (Meanwhile, Swiss citizens are covered by a separate bilateral agreement whereby they are treated basically the same as EEA nationals.) This is the basis of the UK's Immigration EEA Regulations 2006, and the subsequent replacement regulations of 2016.
EU Free Movement law is a constantly evolving and changing, which ensures that these regulations need to evolve frequently and this is shown by the significant number of amendments issued by Statutory instruments from the British Government.
Member states are bound by the EC treaties to implement Directives into national law. However, a significant amount of case law (or precedents), often predating the directive, and the historical development (see Freedom of movement for workers) must also be taken into account to correctly interpret EU law. Still, ambiguities in the Directive and misinterpretation by the member states exist which may require further clarification through national courts and the European Court of Justice. Due to the teleological interpretation of EU Law, more situations are brought under the scope of EU law and consequently provide free movement rights to those who would not otherwise have been given those privileges.
For example, in Gerardo Ruiz Zambrano v Office national de l’emploi (ONEm), the CJEU held that the non-EEA carer of a child who is a Union Citizen would derive rights of residence from the treaty directly and it would therefore be unlawful to refuse a residence card to that carer if "such decisions deprive those children of the genuine enjoyment of the substance of the rights attaching to the status of European Union citizen". Essentially, because the child would be forced to leave the EU with his carer/parent, then they would be deprived of their own rights to move and reside freely within the Member states, that situation would be contrary to EU law and therefore EU rights are extended to the carer. These situations are considered under Regulation 16.
Terminology and applications.
The EEA Regulations define a number of terms in addition to the terms in the Directive 2004/38.
Core and extended family members.
The definition of Core family member (of an EEA national) only includes a spouse or civil partner, children under 21, or dependant children of any age and dependent parents. A person outside of this definition (especially unmarried partners) may fall under the category "extended family member". These include dependants of the EU citizens, members of the household, and a partner in a "durable relationship". While the Directive 2004/38 requires member states to "facilitate entry" for extended family members, the details are not defined and the Directive does not seem to grant any rights to extended family members.
British regulations stated specific criteria for extended family members, including unmarried and same-sex partners. Once an extended family member has been issued with an EEA family permit, Residence Card or Residence Certificate, they were regarded under British regulations as family members as defined by Regulation 7(3).
British Citizens.
EU Free movement rights did not generally apply to family members of British citizens when they are resident in the United Kingdom: this is known as the "wholly internal rule". Family members of British Citizens are expected to apply under the national immigration law (called the "Immigration Rules") which are separate from the implementation of the European law (the "EEA Regulations"). This can result in situations where family members of EU nationals are treated more favourably than those of British Citizens.
For example, applications for 2.5-year leave to remain as a spouse under the Immigration Rules were in excess of £1000 for a 2.5 year period, with an additional NHS surcharge of £250; the applicant must have passed an English language test; the sponsor needed to show a minimum income requirement of around £18,000 per annum; and there was no access to public funds like unemployment benefits. In contrast, an application under the EEA Regulations cost £65 and was valid for 5 years, and the applicant had recourse to public funds as long as their sponsor continued to exercise free movement rights.
The primary situations where British citizens were considered as EU citizens for the purpose of settlement were defined in Regulation 9, the most prevalent situation was known as the Surinder Singh route to citizenship, which was where the British Citizen lived and exercised Free-movement rights in another EU state before returning to the UK.
While it was possible to switch from the British law to the European law, this does reset the clock for acquiring permanent residence. The legal situation of extended family members during this switch was uncertain, because they have to conform to both laws. Switching from European law to British law was possible only after the EEA citizen became settled in the UK. The EEA national is was settled when having attained permanent residence.