To solve the given optimization problem, we first need to convert the natural language description into a symbolic representation. This involves defining variables, an objective function, and constraints based on the problem statement.

Let's define:
- $x_1$ as the amount invested in company A.
- $x_2$ as the amount invested in company B.

The objective is to maximize earnings, which can be represented by the returns from each investment. The returns are 9% for company A and 12% for company B. Thus, the objective function to maximize is:
\[0.09x_1 + 0.12x_2\]

The constraints based on the problem description are:
1. The total amount invested is $500,000: \[x_1 + x_2 = 500,000\]
2. At least two times as much money is invested in company A than in company B: \[x_1 \geq 2x_2\]
3. No more than $200,000 can be invested in company B: \[x_2 \leq 200,000\]
4. Non-negativity constraints for both investments: \[x_1 \geq 0, x_2 \geq 0\]

The symbolic representation of the problem is:
```json
{
    'sym_variables': [('x1', 'amount invested in company A'), ('x2', 'amount invested in company B')],
    'objective_function': '0.09*x1 + 0.12*x2',
    'constraints': ['x1 + x2 = 500000', 'x1 >= 2*x2', 'x2 <= 200000', 'x1 >= 0', 'x2 >= 0']
}
```

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

```python
from gurobipy import *

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

# Define variables
x1 = m.addVar(name='x1', lb=0)  # Amount invested in company A
x2 = m.addVar(name='x2', lb=0)  # Amount invested in company B

# Set the objective function
m.setObjective(0.09*x1 + 0.12*x2, GRB.MAXIMIZE)

# Add constraints
m.addConstr(x1 + x2 == 500000, name='total_investment')
m.addConstr(x1 >= 2*x2, name='investment_ratio')
m.addConstr(x2 <= 200000, name='max_investment_B')

# Optimize the model
m.optimize()

# Print results
if m.status == GRB.OPTIMAL:
    print(f"Optimal investment in company A: {x1.x}")
    print(f"Optimal investment in company B: {x2.x}")
    print(f"Maximum earnings: {m.objVal}")
else:
    print("Model is not optimal")
```