Can a Mac's model year be determined with a Terminal Command? Does anybody know a terminal command that gives me the model of my Mac? 

For example -  "MacBook Pro, Retina, 13-inch, Mid 2013" or "MacBook Pro, Late 2009" or "Mac Mini, Early 2010".

That information does not exist in the SystemProfiler (/usr/sbin/system_profiler SPHardwareDataType), but in OS X 10.7 and OS X 10.8 you can see that information when you click "More Info..." in the "About This Mac" window.
You can indirectly get this information from a web page and the curl command. In the past this URL has been taken down and rate limited and put behind some sort of captcha to prevent this use, so you might need to resort to other avenues like https://checkcoverage.apple.com/ in that case.

Depending on if your serial numer is 11 or 12 characters long take the last 3 or 4 characters, respectively, and feed that to the following URL after the ?cc=XXXX part. If your serial number was 12 character and ended in DJWR, you would issue this command:

curl https://support-sp.apple.com/sp/product?cc=DJWR


To get your serial number, use the following command:

system_profiler SPHardwareDataType | awk '/Serial/ {print $4}'


Thus, you could have a complicated command to query the internet if you need a single command:

curl https://support-sp.apple.com/sp/product?cc=$(
  system_profiler SPHardwareDataType \
    | awk '/Serial/ {print $4}' \
    | cut -c 9-
)


and then run the output of that through sed to cut to the key part

curl -s https://support-sp.apple.com/sp/product?cc=$(
  system_profiler SPHardwareDataType \
    | awk '/Serial/ {print $4}' \
    | cut -c 9-
) | sed 's|.*&lt;configCode&gt;\(.*\)&lt;/configCode&gt;.*|\1|'


There used to be a private library file with these mappings so you could consult it offline, but I noticed it was gone as of 10.8.3 (and perhaps earlier) so the above trick is the only one I know that works on the current OS without third party libraries. 

Some nice third party libararies provide a look up of this:


python code https://github.com/MagerValp/MacModelShelf
JSON mapping https://github.com/krypted/swiftwarrantylookup/blob/master/src/swiftMacWarranty/model_snippets.json


Note that as of November 2017, Apple has forced the use of https over http for this service.