To solve this optimization problem, we first need to define the decision variables and the objective function. Let's denote:

- \(M\) as the number of microwaves sold.
- \(V\) as the number of vents sold.

The profit per microwave is $200, and the profit per vent is $300. The cost of a microwave is $300, and the cost of a vent is $400. The store can spend at most $20,000 on these items. Additionally, there are constraints on the number of microwaves and vents that can be sold:

1. The store sells at least 30 microwaves but at most 65 microwaves.
2. The number of vents sold is at most a third of the number of microwaves sold.

The objective is to maximize profit, which is calculated as the total revenue from selling microwaves and vents minus the total cost of purchasing them.

Let's translate these conditions into mathematical expressions:

- Objective function (to maximize): \(200M + 300V - 300M - 400V = 200M + 300V - 300M - 400V\). However, since we are maximizing profit and the costs are given, we simplify our objective to just maximize revenue because costs are fixed per item: \(200M + 300V\).
- Constraints:
  1. Budget constraint: \(300M + 400V \leq 20000\)
  2. Lower bound on microwaves: \(30 \leq M\)
  3. Upper bound on microwaves: \(M \leq 65\)
  4. Constraint on vents relative to microwaves: \(V \leq \frac{1}{3}M\)

Now, let's express this problem in Gurobi code using Python:

```python
from gurobipy import *

# Create a model
m = Model("Appliance_Store_Profit")

# Define the decision variables
M = m.addVar(vtype=GRB.INTEGER, name="Microwaves")
V = m.addVar(vtype=GRB.INTEGER, name="Vents")

# Set the objective function to maximize profit (simplified as revenue)
m.setObjective(200*M + 300*V, GRB.MAXIMIZE)

# Add constraints
m.addConstr(300*M + 400*V <= 20000, "Budget_Constraint")
m.addConstr(M >= 30, "Min_Microwaves")
m.addConstr(M <= 65, "Max_Microwaves")
m.addConstr(V <= (1/3)*M, "Vent_to_Microwave_Ratio")

# Optimize the model
m.optimize()

# Print out the results
if m.status == GRB.OPTIMAL:
    print("Optimal solution found:")
    print(f"Microwaves to sell: {M.x}")
    print(f"Vents to sell: {V.x}")
    print(f"Maximum Profit: {m.objVal}")
else:
    print("No optimal solution found")
```

This code defines the problem in terms of decision variables (number of microwaves and vents), sets up the objective function to maximize profit, adds all relevant constraints, solves the model, and prints out the results.