The rules for the nominee are set by the individual state. That is, each state determines under what circumstances it will allow a candidate for nomination to appear on the primary ballot. The state rules only deal with the filing requirements for getting on the ballot in the individual state.
While the rules do not explicitly require official membership or registration in the party, the petition signature requirements may do so. States may require that voters in a primary be registered for a specific party (as in Maryland), but some states have "open" primaries.
Marylandprimary ballot for example does not seem to address the membership of the candidate in the party for which he is campaigning.
For principal party candidates
A candidate for federal, statewide or state legislative office seeking
the nomination of a principal political party in a primary election
must submit to the Maryland State Board of Elections a certificate of
candidacy, which notes the office being sought, the year of the
election, the name and address of the candidate, and includes a
statement verifying that the candidate satisfies the legal
requirements for candidacy for the office being sought. A candidate
for statewide or state legislative office must also submit a financial
disclosure form to the Maryland State Ethics Commission.
Kansas also appears to have similar rules.
For party candidates
See statutes: Kansas Statutes, Chapter 25, Article 2,
A candidate seeking the nomination of a party qualified to participate
in primary elections can gain access to the primary ballot in one of
two ways. These are detailed below. By filing a nomination petition
Signature requirements for nomination petitions for party candidates
vary according to the office being sought. For offices elected on a
statewide basis, signatures must equal at least 1 percent of the
state's current voter registration total of the party whose nomination
the candidate is seeking. Gubernatorial candidates must collect
signatures equaling at least 1 percent of the total votes cast for the
party's candidate for secretary of state at the last preceding
election. For offices elected by district, signatures must equal at
least 2 percent of the district's current voter registration total of
the party whose nomination the candidate is seeking.
Nomination petitions for federal and state-level offices (including
state legislative seats) must be submitted to the Kansas Secretary of
State by noon on June 1, prior to the primary election. If June 1
falls on a holiday or weekend, petitions are due by noon on the next
following business day. By paying a filing fee
A candidate may forgo the petition process by submitting a declaration
of candidacy and paying a filing fee. The filing fee varies according
to the office being sought. For statewide and federal offices, the fee
is equal to 1 percent of the office's annual salary. For state senate
candidates, the fee is $75. For state representative candidates, the
fee is $50.
The declaration and accompanying filing fee for federal and
state-level offices (including state legislative seats) must be
submitted to the Kansas Secretary of State by noon on June 1, prior to
the primary election. If June 1 falls on a holiday or weekend,
petitions are due by noon on the next following business day.
In addition to the statutory filing fee, a candidate for federal and
state offices must pay a $20 administrative fee to the Kansas
Secretary of State. A state-level candidate must also pay a
registration fee to the Kansas Governmental Ethics Commission. For
statewide executive offices, the fee is $480. For state legislative
candidates, the fee is $35.