Below is the best I could figure out online by looking at relevant laws. The vast majority of online resources assume that only asylum seekers will ever appeal the decision of the immigration officer and don't discuss what happens in other situations.
Question 1: Are you traveling on VWP or another type of visa?
According to 8 U.S.C. §1187(b):
(b) Waiver of rights
An alien may not be provided a waiver under the program unless the alien has waived any right—
(1) to review or appeal under this chapter of an immigration officer's determination as to the admissibility of the alien at the port of entry into the United States, or
(2) to contest, other than on the basis of an application for asylum, any action for removal of the alien.
So unless you're applying for asylum, you cannot appeal a rejection when traveling through the Visa Waiver Program. Other visa types have broader appeal rights.
Question 2: Were you placed in Expedited Removal?
As per DHS Notice No. DHS-2019-0036:
Under section 235(b)(1) of the INA, 8 U.S.C. 1225(b)(1), DHS may remove, without a hearing before an immigration judge, certain aliens arriving in the United States at a port of entry, and certain other aliens (as designated by the Secretary of Homeland Security) who are inadmissible under sections 212(a)(6)(C) or 212(a)(7) of the INA, 8 U.S.C. 1182(a)(6)(C) or 1182(a)(7).
Sections 212(a)(6)(C) and 212(a)(7) of the INA designate aliens as inadmissible if they lack valid documents necessary for admission, or if they have ever fraudulently or willfully misrepresented a material fact to acquire admission to the United States, including falsely claiming to be a U.S. citizen, or to procure a visa or other immigration-related documentation.
If you are removed due to fraud, misrepresentation, or lacking required documents for entry, you will be subject to expedited removal. This process limits your appeal rights to asylum requests only. The key issue here is that expedited removal decisions are final and cannot be appealed unless you claim to be an asylum seeker. As a result, if a CBP officer unfairly determines that you are inadmissible under "misrepresentation," you would have no formal way to contest that decision.
If you're not on VWP and weren't placed in Expedited Removal, you can file an appeal
According to 8 USC §1225(b)(2):
(2) Inspection of other aliens
(A) In general
Subject to subparagraphs (B) and (C), in the case of an alien who is an applicant for admission, if the examining immigration officer determines that an alien seeking admission is not clearly and beyond a doubt entitled to be admitted, the alien shall be detained for a proceeding under section 1229a of this title.
(B) Exception
Subparagraph (A) shall not apply to an alien—
(i) who is a crewman,
(ii) to whom paragraph (1) applies, or
(iii) who is a stowaway.
Paragraph (1) refers to Expedited Removals. If you weren't classified as eligible for the Expedited procedure, you'll be eligible for the procedure in §1229a. How this works in practice is very hard to figure out. There are few explanations or stories online, and neither INS, USCIS, nor CBP discuss how it works for people who don't claim to be asylum seekers.